3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fetch_news(){ $data = file_get_contents('http://www.tagesschau.de/xml/rss2'); $data = simplexml_load_string($data); //print_r($data); $articles = array(); foreach ($data->channel->item as $item) { $articles[] = array( 'title' => (string)$item->title, 'description' => (string)$item->description, 'link' => (string)$item->link, 'date' => (string)$item->pubDate, ); } //print_r($articles); } foreach (fetch_news() as $article){ $article['link']; }
Output for git.master, git.master_jit
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for www.tagesschau.de failed: System error in /in/gO3iJ on line 3 Warning: file_get_contents(http://www.tagesschau.de/xml/rss2): Failed to open stream: php_network_getaddresses: getaddrinfo for www.tagesschau.de failed: System error in /in/gO3iJ on line 3 Warning: Attempt to read property "channel" on bool in /in/gO3iJ on line 9 Warning: Attempt to read property "item" on null in /in/gO3iJ on line 9 Warning: foreach() argument must be of type array|object, null given in /in/gO3iJ on line 9 Warning: foreach() argument must be of type array|object, null given in /in/gO3iJ on line 23
Output for rfc.property-hooks
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for www.tagesschau.de failed: System error in /in/gO3iJ on line 3 Warning: file_get_contents(http://www.tagesschau.de/xml/rss2): Failed to open stream: php_network_getaddresses: getaddrinfo for www.tagesschau.de failed: System error in /in/gO3iJ on line 3 Warning: Attempt to read property "channel" on false in /in/gO3iJ on line 9 Warning: Attempt to read property "item" on null in /in/gO3iJ on line 9 Warning: foreach() argument must be of type array|object, null given in /in/gO3iJ on line 9 Warning: foreach() argument must be of type array|object, null given in /in/gO3iJ on line 23

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
35.32 ms | 402 KiB | 8 Q