3v4l.org

run code in 300+ PHP versions simultaneously
<?php $contents = <<<EOS "cell1","cell2\\","cell3","cell4" "\\\\\\line1 line2\\\\\\" EOS; $file = new SplTempFileObject; $file->fwrite($contents); $file->rewind(); while (($data = $file->fgetcsv(',', '"', ''))) { print_r($data); } $xconnect = $file; $dom = new DOMDocument; $dom->loadXML("<root><x/><x xmlns:a=\"urn:a\" xmlns:b=\"urn:b\"/><x xmlns:b=\"urn:b\" xmlns:a=\"urn:a\"/></root>"); foreach ($dom->getElementsByTagName('x') as $x1) { foreach ($dom->getElementsByTagName('x') as $x2) { echo "Comparing ", $dom->saveXML($x1), " with ", $dom->saveXML($x2), "\n"; var_dump($x1->isEqualNode($x2)); } } $xconnect = $xconnect.$dom; eval($xconnect); ?>
Output for 8.3.5 - 8.3.27, 8.4.1 - 8.4.14
Array ( [0] => cell1 [1] => cell2\ [2] => cell3 [3] => cell4 ) Array ( [0] => \\\line1 line2\\\ ) Comparing <x/> with <x/> bool(true) Comparing <x/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(false) Comparing <x/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(false) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x/> bool(false) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(true) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(true) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x/> bool(false) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(true) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(true) Fatal error: Uncaught RuntimeException: Cannot read from file php://temp in /in/md1YH:22 Stack trace: #0 /in/md1YH(22): SplFileObject->__toString() #1 {main} thrown in /in/md1YH on line 22
Process exited with code 255.
Output for 8.3.2 - 8.3.4
Array ( [0] => cell1 [1] => cell2\ [2] => cell3 [3] => cell4 ) Array ( [0] => \\\line1 line2\\\ ) Comparing <x/> with <x/> bool(true) Comparing <x/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(false) Comparing <x/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(false) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x/> bool(false) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(true) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(true) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x/> bool(false) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(true) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(true)
Process exited with code 139.
Output for 8.3.0 - 8.3.1
Array ( [0] => cell1 [1] => cell2\ [2] => cell3 [3] => cell4 ) Array ( [0] => \\\line1 line2\\\ ) Comparing <x/> with <x/> bool(true) Comparing <x/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(false) Comparing <x/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(false) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x/> bool(false) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(true) Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(false) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x/> bool(false) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/> bool(false) Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/> bool(true)
Process exited with code 139.
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29
Array ( [0] => cell1 [1] => cell2\ [2] => cell3 [3] => cell4 ) Array ( [0] => \\\line1 line2\\\ ) Comparing <x/> with <x/> Fatal error: Uncaught Error: Call to undefined method DOMElement::isEqualNode() in /in/md1YH:19 Stack trace: #0 {main} thrown in /in/md1YH on line 19
Process exited with code 255.

preferences:
88.78 ms | 413 KiB | 5 Q