Код: Выделить всё
Array
(
[0] => Array
(
[EndpointArn] => arn:aws:sns
[Attributes] => Array
(
[Enabled] => true
[Token] => APA91
[CustomUserData] => Alcatel
)
)
[1] => Array
(
[EndpointArn] => arn:aws:sns:ap
[Attributes] => Array
(
[Enabled] => true
[Token] => APA91bGC
[CustomUserData] => Oppo
)
)
)
Я новичок в yalinqo, поэтому после проб и ошибок мне удалось распечатать CustomUserData с помощью этого кода:
Код: Выделить всё
$result= from($Model2['Endpoints'][0]['Attributes'])->select(function($np) { return $np; });
print $result->toArrayDeep()['CustomUserData'];
Это это код:
Код: Выделить всё
print
from($Model2['Endpoints'])
->select(function($np){ return $np['EndpointArn']; })
->where(function($np){return $np['Attributes']['CustomUserData'] == 'Oppo';})
->toArrayDeep()
;
Код: Выделить всё
Warning: Illegal string offset 'Attributes' in /home/u
Warning: Illegal string offset 'CustomUserData' in /home/u
Warning: Illegal string offset 'Attributes' in /home/u
Warning: Illegal string offset 'CustomUserData' in /home/u
Код: Выделить всё
print
from($Model2['Endpoints'])
->select(function($np){ return $np['EndpointArn']; })
->where(function($np){return $np['Attributes']['CustomUserData'] == 'Oppo';})
;
Код: Выделить всё
Catchable fatal error: Object of class YaLinqo\Enumerable could not be converted to string in
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/321 ... deep-array
Мобильная версия