I've got several arrays which are like this :
$myArray = [
[
'value1' => 1,
'value2' => 2,
'value3' => 3,
'objectValue' =>
'name' => 'toto'
'age' => 7,
'sexe' => 'M'
]
[
'value1' => 11,
'value2' => 22,
'value3' => 33,
'objectValue' =>
'name' => 'tata'
'age' => 77,
'sexe' => 'F'
]
]
I need to access in all my arrays only the property 'name' in objectValue. I started like this :
if is_array($myArray){
return array_map(
static function ($params){
if (is_object($params)) {
return array_map(
static function ($param){
//Here everything is print but I want only the name
return ['name' => $param]
}
)
}
}
)
}
Any idea how to do it ?