Est-ce possible de retourner une matrice dans une fonction PHP?
Bonjour,
Je me demande si c'est possible de retourner une matrice dans une fonction PHP. Si oui comment faire? Voila ma fonction:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
function Getparents($conceptid, $distance, $tabConceptID)
{
$db = new DatabaseConnection(CFG_DB_HOST, CFG_DB_USER, CFG_DB_PASS, CFG_DB_DATABASE);
$db->query("SET CHARACTER SET 'utf8'");
$db->query("SET NAMES utf8");
$queryParents = "SELECT relation.ConceptID2 FROM relation WHERE relation.ConceptID1=\"$conceptid\";";
$Parents = $db->query_all($queryParents);
for ($i = 0; $i < count($Parents); $i++)
{
$parid = $Parents[$i]['ConceptID2'];
$count=count($tabConceptID);
$tabConceptID[$count][0]= $parid;
$tabConceptID[$count][1]= $distance;
Getparents($parid, $distance+1, $tabConceptID);
}
} |
J'ai besoin de retourner une matrice, puisque dans une autre fonction j'apelle celle la pour comparer deux matrices.
Merci d'avance pour votre aide, et j'espère qu'il y en a des solutions :?