Here is my var_dump:
array(2) {
[1]=>
object(stdClass)#382 (3) {
["name"]=>
string(12) "Other fields"
["sortorder"]=>
string(1) "1"
["id"]=>
int(1)
}
[3]=>
object(stdClass)#381 (3) {
["name"]=>
string(6) "custom"
["sortorder"]=>
string(1) "2"
["id"]=>
int(3)
}
}
I need some PHP to select the 2nd object, obviously it wont always be the 2nd object, so I need to select it based on its [“name”] which will always be “custom”.
The below code give’s me all the names but I just want “custom” and the get the ID of custom.
foreach ($profilecats as $cat) {
$settings .= $something->name;
}
1 Answer