Answer the question
In order to leave comments, you need to log in
Again, it is not possible to enumerate the array, explain how correctly?
here is the culprit
array(10) {
[0]=> array(1) {
[0]=> object(stdClass)#110 (7) {
["id"]=> string(5) "27741"
["type"]=> string(8) "KPPeople"
["nameRU"]=> string(30) "Джей Джей Абрамс"
["nameEN"]=> string(11) "J.J. Abrams"
["posterURL"]=> string(29) "actor_iphone/iphone_27741.jpg"
["professionText"]=> string(18) "Режиссеры"
["professionKey"]=> string(8) "director" }
}
[1]=> array(127) {
[0]=> object(stdClass)#108 (8) {
["id"]=> string(7) "2196854"
["type"]=> string(8) "KPPeople"
["nameRU"]=> string(21) "Джон Бойега"
["nameEN"]=> string(11) "John Boyega"
["description"]=> string(4) "Finn"
["posterURL"]=> string(31) "actor_iphone/iphone_2196854.jpg"
["professionText"]=> string(12) "Актеры"
["professionKey"]=> string(5) "actor" }
[1]=> object(stdClass)#111 (8) {
["id"]=> string(7) "3016071"
["type"]=> string(8) "KPPeople"
["nameRU"]=> string(21) "Дэйзи Ридли"
["nameEN"]=> string(12) "Daisy Ridley"
["description"]=> string(3) "Rey"
["posterURL"]=> string(31) "actor_iphone/iphone_3016071.jpg" ["professionText"]=> string(12) "Актеры"
["professionKey"]=> string(5) "actor" }...
}
[2]=> array(14) {
[0]=> object(stdClass)#237 (7) {
["id"]=> string(5) "27741"
["type"]=> string(8) "KPPeople"
["nameRU"]=> string(30) "Джей Джей Абрамс"
["nameEN"]=> string(11) "J.J. Abrams"
...}
[3]=> array(1) {
[0]=> object(stdClass)#251 (7) {
["id"]=> string(7) "2469864"
["type"]=> string(8) "KPPeople"
["nameRU"]=> string(33) "Георгий Даниелянц"
["nameEN"]=> string(0) ""
["posterURL"]=> string(31) "actor_iphone/iphone_2469864.jpg" ["professionText"]=> string(33) "Режиссеры дубляжа"
["professionKey"]=> string(14) "voice_director"
}
}...
Answer the question
In order to leave comments, you need to log in
forech ($array as $items) {
foreach($items as $object) {
/* последний уровень объект, а не массив
тут уже доступны ваши свойства, следующим образом.
$object->id
$object->nameRU
$object->posterURL
$object->professionKey
*/
}
}
$result =array();
if (count($array)) {
foreach ($array as $lv1) {
foreach ($v as $lv2) {
$result[] = array(
'id' => $lv2['id'],
'nameRu' => $lv2['nameRu'],
'posterURL' => $lv2['posterURL'],
'professionKey' => $lv2['professionKey'],
);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question