Reputation: 5
I need to pull out the [name] information only from this array that includes php stdClass Objects. How do I do this please?
Array ( [VigdiH] => stdClass Object ( [ip] => 555.50.175.142 [name] => Test Name [origin] => www [cycle_day] => 3 [email] => [email protected] [campaign] => 5555 [created_on] => 2014-03-28 14:22:58 [changed_on] => ))
Upvotes: 1
Views: 1033
Reputation: 24661
If your array is named $arr
you could do:
foreach($arr as $object) {
echo $object->name . "\n";
}
Upvotes: 3
Reputation: 57709
You can get properties from an object using ->
$data = array(/**/);
$data["VigdiH"]->name; // name
Upvotes: 2