I have an array named $result, the output for print_r($result) look like this.
Array
(
[0] => Profile Object
(
[id] => 3
[name] => alvis
[parentLink] => ProfileLink Object
(
[href] => web
[type] => data
)
)
[1] => Profile Object
(
[id] => 3
[name] => gorgia
[parentLink] => ProfileLink Object
(
[href] => text
[type] => values
)
)
[2] => Profile Object
(
[id] => 4
[name] => text
[parentLink] => ProfileLink Object
(
[href] => text
[type] => values
)
)
)
I tried displaying just the name by using:
foreach ($results[name] as $key => $value) {
echo $key . ": " . $value."<br>";
}
but I got an error Cannot use object of type Profile as array.
and when I tried
foreach ($results->name as $key => $value) {
echo $key . ": " . $value."<br>";
}
I got another error : Invalid argument supplied for foreach()
is there's away to display the id and the name?