Just for curiosity (I know it can be a single line foreach statement), is there some PHP array function (or a combination of many) that given an array like:
Because your array is array of object then you can call (its like a variable of class) try to call with this:
foreach ($arrays as $object) {
Echo $object->id;
Echo "
";
Echo $object->name;
Echo "
";
Echo $object->email;
Echo "
";
}
Then you can do
// your array of object example $arrays;
$result = array();
foreach ($arrays as $array) {
$result[$array->id] = $array->name;
}
echo "";
print_r($result);
echo "
";
Sorry I'm answering on handphone. Can't edit the code