Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP issue json_decode echo array
    primarykey
    data
    text
    <pre><code>&lt;?php $string = file_get_contents("http://www.reddit.com/r/news.json"); $array = json_decode($string, true); echo $array['data'][0]['children'][0]['data'][0]['title'][0]; ?&gt; </code></pre> <p>I've got a problem- the code doesn't echo anything.</p> <p>I'm kinda new to json_decode, so any help is appreciated :-)</p> <p><strong>Edit:</strong> As a response to a comment, here's what print_r results to:</p> <pre><code>Array ( [kind] =&gt; Listing [data] =&gt; Array ( [modhash] =&gt; [children] =&gt; Array ( [0] =&gt; Array ( [kind] =&gt; t3 [data] =&gt; Array ( [domain] =&gt; syracuse.com [banned_by] =&gt; [media_embed] =&gt; Array ( ) [subreddit] =&gt; news [selftext_html] =&gt; [selftext] =&gt; [likes] =&gt; [secure_media] =&gt; [link_flair_text] =&gt; [id] =&gt; 1qdtqr [secure_media_embed] =&gt; Array ( ) [clicked] =&gt; [stickied] =&gt; [author] =&gt; cadencehz [media] =&gt; [score] =&gt; 1552 [approved_by] =&gt; [over_18] =&gt; [hidden] =&gt; [thumbnail] =&gt; [subreddit_id] =&gt; t5_2qh3l [edited] =&gt; [link_flair_css_class] =&gt; [author_flair_css_class] =&gt; [downs] =&gt; 978 [saved] =&gt; [is_self] =&gt; [permalink] =&gt; /r/news/comments/1qdtqr/thousands_defend_grocery_store_employee_with/ [name] =&gt; t3_1qdtqr [created] =&gt; 1384215998 [url] =&gt; http://www.syracuse.com/news/index.ssf/2013/11/thousands_come_to_defense_of_clay_wegmans_employee_with_aspergers_syndrome_after.html#incart_m-rpt-2 [author_flair_text] =&gt; [title] =&gt; Thousands defend grocery store employee with Asperger's syndrome after customer yells at him for being too slow [created_utc] =&gt; 1384187198 [ups] =&gt; 2530 [num_comments] =&gt; 401 [visited] =&gt; [num_reports] =&gt; [distinguished] =&gt; ) ) [1] =&gt; Array ( [kind] =&gt; t3 [data] =&gt; Array ( [domain] =&gt; bostonherald.com [banned_by] =&gt; [media_embed] =&gt; Array ( ) [subreddit] =&gt; news [selftext_html] =&gt; [selftext] =&gt; [likes] =&gt; [secure_media] =&gt; [link_flair_text] =&gt; [id] =&gt; 1qddl6 [secure_media_embed] =&gt; Array ( ) [clicked] =&gt; [stickied] =&gt; [author] =&gt; boxofrain [media] =&gt; [score] =&gt; 2086 [approved_by] =&gt; [over_18] =&gt; [hidden] =&gt; [thumbnail] =&gt; [subreddit_id] =&gt; t5_2qh3l [edited] =&gt; [link_flair_css_class] =&gt; [author_flair_css_class] =&gt; [downs] =&gt; 2556 [saved] =&gt; [is_self] =&gt; [permalink] =&gt; /r/news/comments/1qddl6/motorcycle_stolen_in_1961_found_is_recovered_and/ [name] =&gt; t3_1qddl6 [created] =&gt; 1384199801 [url] =&gt; http://bostonherald.com/news_opinion/offbeat_news/2013/11/man_glad_stolen_motorcycle_found_after_46_years [author_flair_text] =&gt; [title] =&gt; Motorcycle stolen in 1961 found is recovered and will be returned to it 73 year old owner. [created_utc] =&gt; 1384171001 [ups] =&gt; 4642 [num_comments] =&gt; 141 [visited] =&gt; [num_reports] =&gt; [distinguished] =&gt; ) ) [2] =&gt; Array ( [kind] =&gt; t3 [data] =&gt; Array ( [domain] =&gt; hosted.ap.org [banned_by] =&gt; [media_embed] =&gt; Array ( ) [subreddit] =&gt; news [selftext_html] =&gt; [selftext] =&gt; [likes] =&gt; [secure_media] =&gt; [link_flair_text] =&gt; [id] =&gt; 1qe6gp [secure_media_embed] =&gt; Array ( ) [clicked] =&gt; [stickied] =&gt; [author] =&gt; donkey-kick [media] =&gt; [score] =&gt; 415 [approved_by] =&gt; [over_18] =&gt; [hidden] =&gt; [thumbnail] =&gt; [subreddit_id] =&gt; t5_2qh3l [edited] =&gt; [link_flair_css_class] =&gt; [author_flair_css_class] =&gt; [downs] =&gt; 334 [saved] =&gt; [is_self] =&gt; [permalink] =&gt; /r/news/comments/1qe6gp/atheist_mega_churches_take_hold_in_the_us_and/ [name] =&gt; t3_1qe6gp [created] =&gt; 1384224670 [url] =&gt; http://hosted.ap.org/dynamic/stories/U/US_ATHEIST_MEGACHURCH?SITE=AP&amp;amp;SECTION=HOME&amp;amp;TEMPLATE=DEFAULT&amp;amp;CTIME=2013-11-10-17-03-15 [author_flair_text] =&gt; [title] =&gt; Atheist Mega Churches take hold in the US and around the world. [created_utc] =&gt; 1384195870 [ups] =&gt; 749 [num_comments] =&gt; 368 [visited] =&gt; [num_reports] =&gt; [distinguished] =&gt; ) ) [3] =&gt; Array ( [kind] =&gt; t3 [data] =&gt; Array ( [domain] =&gt; abcnews.go.com [banned_by] =&gt; [media_embed] =&gt; Array ( ) [subreddit] =&gt; news [selftext_html] =&gt; [selftext] =&gt; [likes] =&gt; [secure_media] =&gt; [link_flair_text] =&gt; [id] =&gt; 1qdie4 [secure_media_embed] =&gt; Array ( ) [clicked] =&gt; [stickied] =&gt; [author] =&gt; Hoosier_made [media] =&gt; [score] =&gt; 984 [approved_by] =&gt; [over_18] =&gt; [hidden] =&gt; [thumbnail] =&gt; [subreddit_id] =&gt; t5_2qh3l [edited] =&gt; [link_flair_css_class] =&gt; [author_flair_css_class] =&gt; [downs] =&gt; 400 [saved] =&gt; [is_self] =&gt; [permalink] =&gt; /r/news/comments/1qdie4/abc_news_amy_robach_has_mammogram_live_on_gma/ [name] =&gt; t3_1qdie4 [created] =&gt; 1384206209 [url] =&gt; http://abcnews.go.com/blogs/health/2013/11/11/abc-news-amy-robach-reveals-breast-cancer-diagnosis/ [author_flair_text] =&gt; [title] =&gt; ABC News’ Amy Robach has mammogram live on GMA. Results Reveal Breast Cancer Diagnosis. [created_utc] =&gt; 1384177409 [ups] =&gt; 1384 [num_comments] =&gt; 130 [visited] =&gt; [num_reports] =&gt; [distinguished] =&gt; ) ) // ECT... I CUT HERE BECAUSE IT WENT ON FOR A WHILE [after] =&gt; t3_1qdinr [before] =&gt; ) ) </code></pre> <p>Here's the url to the exact output, I had to trim the code to fit the character limit so maybe there's something I messed up ! :P</p> <p>Okay: <a href="http://dumbsearch.com/trending.php" rel="nofollow">Link goes here...</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload