samedi 19 avril 2014

I have an array within an array but cannot figure out how to access the interior elements


Vote count:

0




Here is an excerpt of my code. I am going through gathered data and inputting fId and distance into friendObj. Then after that data is put in I want to put the entire friendObj into another array called friendArry. I cannot seem to figure out how to access the individual elements of the interior array from the outer array. Is there any elegant way to do this?


Also on a side note, my intention is to eventually get all of the friendObj and sort them based on distance. How could I do that?



$friendObj = array('id' => $fId, 'distance' => $distanceFromYou);

$friendsArry;
array_push($friendsArry, $friendObj);
echo "Test2: ". $friendsArray[0][id]."<br />";
echo "<br />";


asked 39 secs ago






Aucun commentaire:

Enregistrer un commentaire