3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml_reader = \XMLReader::fromString(' <sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd"> <head> <variable name="s"/> <variable name="p"/> </head> <results> <result> <binding name="s"><uri>https://assetmodel.moxio.com/concept/bestaat_uit</uri></binding> <binding name="p"><uri>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</uri></binding> </result> <result> <binding name="s"><uri>https://assetmodel.moxio.com/concept/bestaat_uit</uri></binding> </result> </results> </sparql>'); $success = $xml_reader->next("sparql"); assert($success, "The XML-reply should start with a sparql element"); $success = $xml_reader->read(); assert($success, "It should be possible to move into the sparql element"); $success = $xml_reader->next("head"); assert($success, "The sparql element should contain a head element"); $success = $xml_reader->read(); assert($success, "It should be possible to move into the sparql element"); $success = $xml_reader->next("results"); assert($success, "The sparql element should contain a head element"); while ($xml_reader->read() === true) { if ($xml_reader->next("result") === true) { $result_as_dom_node = $xml_reader->expand(); assert($result_as_dom_node !== false, "The result-element could not be expanded to a dom node"); /** @var \DOMNode $binding_node */ foreach ($result_as_dom_node->childNodes as $binding_node) { if ($binding_node->nodeType === XML_ELEMENT_NODE) { $variable_name = $binding_node->getAttribute("name"); /** @var \DOMNode $binding_value_node */ foreach ($binding_node->childNodes as $binding_value_node) { } } } } }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.130.0080.00119.16
8.4.120.0110.00920.80
8.4.110.0120.00919.09
8.4.100.0330.00617.66
8.4.90.0110.00919.79
8.4.80.0140.00619.80
8.3.260.0110.00816.25
8.3.250.0090.01018.68
8.3.240.0140.00616.50
8.3.230.0100.01018.48
8.3.220.0100.00918.68
8.3.180.0100.01018.55
8.3.50.0120.00718.64
8.2.290.0110.00918.96
8.2.80.0160.00717.39

preferences:
37.36 ms | 403 KiB | 5 Q