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) { } } } } }
Output for git.master_jit, git.master

Process exited with code 139.

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:
23.78 ms | 405 KiB | 5 Q