3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<ENDXML <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title>Cricinfo Live Scores</title> <ttl>2</ttl> <link>http://www.cricinfo.com</link> <description>Latest scores from Cricinfo</description> <copyright>(c)Cricinfo</copyright> <language>en-gb</language> <pubDate>Fri, 23 Feb 2018 04:07:02 +0000</pubDate> <item> <title>Boland 25/3 * v KwaZulu-Natal 264/10 </title> <link>http://www.cricinfo.com/ci/engine/match/1123494.html?CMP=OTC-RSS </link> <description>Boland 25/3 * v KwaZulu-Natal 264/10 </description> <guid>http://www.cricinfo.com/ci/engine/match/1123494.html</guid> </item> <item> <title>North West 205/10 v Easterns 123/3 *</title> <link>http://www.cricinfo.com/ci/engine/match/1123495.html?CMP=OTC-RSS </link> <description>North West 205/10 v Easterns 123/3 *</description> <guid>http://www.cricinfo.com/ci/engine/match/1123495.html</guid> </item> <item> <title>Eastern Province 306/6 * v Gauteng</title> <link>http://www.cricinfo.com/ci/engine/match/1123496.html?CMP=OTC-RSS </link> <description>Eastern Province 306/6 * v Gauteng</description> <guid>http://www.cricinfo.com/ci/engine/match/1123496.html</guid> </item> <item> <title>Namibia v Free State 354/8 *</title> <link>http://www.cricinfo.com/ci/engine/match/1123498.html?CMP=OTC-RSS </link> <description>Namibia v Free State 354/8 *</description> <guid>http://www.cricinfo.com/ci/engine/match/1123498.html</guid> </item> <item> <title>South Africa A 220/10 v Australia 87/3 *</title> <link>http://www.cricinfo.com/ci/engine/match/1075981.html?CMP=OTC-RSS </link> <description>South Africa A 220/10 v Australia 87/3 *</description> <guid>http://www.cricinfo.com/ci/engine/match/1075981.html</guid> </item> <item> <title>Guyana 231/10 * v Windward Islands 286/7 </title> <link>http://www.cricinfo.com/ci/engine/match/1134092.html?CMP=OTC-RSS </link> <description>Guyana 231/10 * v Windward Islands 286/7 </description> <guid>http://www.cricinfo.com/ci/engine/match/1134092.html</guid> </item> <item> <title>Karachi Kings v Quetta Gladiators</title> <link>http://www.cricinfo.com/ci/engine/match/1128819.html?CMP=OTC-RSS </link> <description>Karachi Kings v Quetta Gladiators</description> <guid>http://www.cricinfo.com/ci/engine/match/1128819.html</guid> </item> <item> <title>Multan Sultans v Lahore Qalandars</title> <link>http://www.cricinfo.com/ci/engine/match/1128820.html?CMP=OTC-RSS </link> <description>Multan Sultans v Lahore Qalandars</description> <guid>http://www.cricinfo.com/ci/engine/match/1128820.html</guid> </item> </channel> </rss> ENDXML; $rss->SimpleXML_Load_String($xml); $list = array(); $found = 0; foreach ($rss->getElementsByTagName('item') as $node) { $item = array( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue ); array_push($list, $item); } $numberofresults = 20; for ($i = 0; $i < $numberofresults; $i++) { $title = $list[$i]['title']; $titletolower = strtolower($title); $desc = $list[$i]['desc']; $desctolower = strtolower($desc); if (strpos($desctolower, "*") !== false) { $desc = 'Live'; } else { $desc = ' Not Live'; } echo $title . "\n"; echo $desc . "\n"; $found++; } if ($found == 0) { echo $list[$i]['title'][0]; } ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined variable $rss in /in/Lc1Ii on line 58 Fatal error: Uncaught Error: Call to a member function SimpleXML_Load_String() on null in /in/Lc1Ii:58 Stack trace: #0 {main} thrown in /in/Lc1Ii on line 58
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Undefined variable $rss in /in/Lc1Ii on line 58 Fatal error: Uncaught Error: Call to a member function SimpleXML_Load_String() on null in /in/Lc1Ii:58 Stack trace: #0 {main} thrown in /in/Lc1Ii on line 58
Process exited with code 255.
Output for 7.0.5 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: rss in /in/Lc1Ii on line 58 Fatal error: Uncaught Error: Call to a member function SimpleXML_Load_String() on null in /in/Lc1Ii:58 Stack trace: #0 {main} thrown in /in/Lc1Ii on line 58
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to a member function SimpleXML_Load_String() on null in /in/Lc1Ii:58 Stack trace: #0 {main} thrown in /in/Lc1Ii on line 58
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: rss in /in/Lc1Ii on line 58 Fatal error: Uncaught Error: Call to a member function SimpleXML_Load_String() on unknown in /in/Lc1Ii:58 Stack trace: #0 {main} thrown in /in/Lc1Ii on line 58
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Notice: Undefined variable: rss in /in/Lc1Ii on line 58 Fatal error: Call to a member function SimpleXML_Load_String() on null in /in/Lc1Ii on line 58
Process exited with code 255.

preferences:
279.41 ms | 401 KiB | 289 Q