Задать вопрос
@WQP

Как правильно обратиться к массиву?

Есть код:
Array ( [0] => Array ( [created_at] => Fri Jul 11 16:56:54 +0000 2014 [id] => 487641695299706882 [id_str] => 487641695299706882 [text] => #EvaGreen @campari Calendar 2015 Teaser Trailer http://t.co/IHcrzsZLsl [source] => iOS [truncated] => [in_reply_to_status_id] => [in_reply_to_status_id_str] => [in_reply_to_user_id] => [in_reply_to_user_id_str] => [in_reply_to_screen_name] => [user] => Array ( [id] => 184154013 [id_str] => 184154013 [name] => Eva Green Web [screen_name] => EvaGreenWeb [location] => Demimonde [description] => Approved Account; NOT EVA - Your oldest & largest online site for #EvaGreen, best known for #TheDreamers & #CasinoRoyale #PennyDreadful #TheSalvation #SinCity2 [url] => http://t.co/hSd0xCOY9v [entities] => Array ( [url] => Array ( [urls] => Array ( [0] => Array ( [url] => http://t.co/hSd0xCOY9v [expanded_url] => http://evagreenweb.com [display_url] => evagreenweb.com [indices] => Array ( [0] => 0 [1] => 22 ) ) ) ) [description] => Array ( [urls] => Array ( ) ) ) [protected] => [followers_count] => 9978 [friends_count] => 87 [listed_count] => 51 [created_at] => Sat Aug 28 20:53:07 +0000 2010 [favourites_count] => 4416 [utc_offset] => -10800 [time_zone] => Brasilia [geo_enabled] => [verified] => [statuses_count] => 10995 [lang] => en [contributors_enabled] => [is_translator] => [is_translation_enabled] => [profile_background_color] => 0A0A0A [profile_background_image_url] => http://pbs.twimg.com/profile_background_images/453205822407856129/89rU_aRC.jpeg [profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/453205822407856129/89rU_aRC.jpeg [profile_background_tile] => [profile_image_url] => http://pbs.twimg.com/profile_images/478031494980435969/O9peX_Ah_normal.jpeg [profile_image_url_https] => https://pbs.twimg.com/profile_images/478031494980435969/O9peX_Ah_normal.jpeg [profile_banner_url] => https://pbs.twimg.com/profile_banners/184154013/1395796105 [profile_link_color] => 611742 [profile_sidebar_border_color] => FFFFFF [profile_sidebar_fill_color] => B188B2 [profile_text_color] => 4A4164 [profile_use_background_image] => 1 [default_profile] => [default_profile_image] => [following] => [follow_request_sent] => [notifications] => ) [geo] => [coordinates] => [place] => [contributors] => [retweet_count] => 2 [favorite_count] => 4 [entities] => Array ( [hashtags] => Array ( [0] => Array ( [text] => EvaGreen [indices] => Array ( [0] => 0 [1] => 9 ) ) ) [symbols] => Array ( ) [urls] => Array ( [0] => Array ( [url] => http://t.co/IHcrzsZLsl [expanded_url] => http://youtu.be/RSE6dpuPd5I [display_url] => youtu.be/RSE6dpuPd5I [indices] => Array ( [0] => 49 [1] => 71 ) ) ) [user_mentions] => Array ( [0] => Array ( [screen_name] => campari [name] => Campari [id] => 9222382 [id_str] => 9222382 [indices] => Array ( [0] => 10 [1] => 18 ) ) ) ) [favorited] => [retweeted] => [possibly_sensitive] => [lang] => en ) )

Обращаюсь:
echo $array_twit['0']['id'];
echo $array_twit['0']->id;
echo $array_twit->0->id;
Нечего не выходит. Помогите решить проблему
  • Вопрос задан
  • 2419 просмотров
Подписаться 2 Оценить 1 комментарий
Решения вопроса 1
@Grag
Пропробуйте так:
$arr[0][id]

А вообще то нужно чтобы «ID» было строкой, а не фиг пойми чем...
[id] #error
['id'] #string
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
@Heafy
У Вас не код, а набор символов.
Видимо этот массив не прошёл какую-то обработку, возможно json..
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы