3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php <?php $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/zing/srw/ srw-types.xsd"> <version>1.2</version> <numberOfRecords>23</numberOfRecords> <records> <record> <recordSchema>http://standaarden.overheid.nl/sru/</recordSchema> <recordPacking>xml</recordPacking> <recordData> <gzd xmlns="http://standaarden.overheid.nl/sru" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:overheid="http://standaarden.overheid.nl/owms/terms/" xmlns:overheidrg="http://standaarden.overheid.nl/cvdr/terms/" xsi:schemaLocation="http://standaarden.overheid.nl/sru gzd.xsd"> <originalData> <overheidrg:meta> <owmskern> <dcterms:identifier>123431_2</dcterms:identifier> <dcterms:title>Ligplaatsenverordening 2009</dcterms:title> <dcterms:language>nl</dcterms:language> <dcterms:type scheme="overheid:Informatietype">regeling</dcterms:type> <dcterms:creator scheme="overheid:Gemeente">Muiden</dcterms:creator> <dcterms:modified>2015-08-27</dcterms:modified> </owmskern> <owmsmantel> <dcterms:isFormatOf resourceIdentifier="">Onbekend</dcterms:isFormatOf> <dcterms:alternative>Ligplaatsenverordening 2009</dcterms:alternative> <dcterms:source resourceIdentifier="">artikel 149 van de Gemeentewet</dcterms:source> <dcterms:isRatifiedBy scheme="overheid:BestuursorgaanGemeente">gemeenteraad</dcterms:isRatifiedBy> <dcterms:subject>ruimtelijke ordening, verkeer en vervoer</dcterms:subject> <dcterms:issued>2012-12-20</dcterms:issued> </owmsmantel> <cvdripm> <overheidrg:inwerkingtredingDatum>2013-01-01</overheidrg:inwerkingtredingDatum> <overheidrg:uitwerkingtredingDatum /> <overheidrg:betreft>Onbekend</overheidrg:betreft> <overheidrg:kenmerk>Onbekend</overheidrg:kenmerk> <overheidrg:onderwerp /> <overheidrg:gedelegeerdeRegelgeving>&lt;al &gt;Geen&lt;/al&gt;</overheidrg:gedelegeerdeRegelgeving> <overheidrg:redactioneleToevoeging>&lt;al &gt;Geen&lt;/al&gt;</overheidrg:redactioneleToevoeging> </cvdripm> </overheidrg:meta> </originalData> <enrichedData> <organisatietype>Gemeente</organisatietype> <publicatieurl_xhtml>http://decentrale.regelgeving.overheid.nl/cvdr/xhtmloutput/Historie/Muiden/123431/123431_2.html</publicatieurl_xhtml> <publicatieurl_xml>http://decentrale.regelgeving.overheid.nl/cvdr/xmloutput/Historie/Muiden/123431/123431_2.xml</publicatieurl_xml> </enrichedData> </gzd> </recordData> <recordPosition>1</recordPosition> </record> </records> </searchRetrieveResponse> XML; $xml = new SimpleXMLElement($xml); $ns = $xml->getNamespaces(true); $xml->registerXPathNamespace('overheidrg', $ns['overheidrg']); $xmlRecords = $xml->xpath('//overheidrg:*'); // Loop the array which is returned from xpath which will contain all the SimpleXMLElement's from the 'overheidrg' // namespace like <overheidrg:meta> and <overheidrg:inwerkingtredingDatum> foreach ($xmlRecords as $record) { // Loop the children for those SimpleXMLElement's foreach ($record->children() as $recordChild) { // Get the children using the namespace 'dcterms' $children = $recordChild->children($ns['dcterms']); // Check for the name of the xml element if ($recordChild->getName() === "owmskern") { $identifier = $children->identifier->__toString(); $title = $children->title->__toString(); $language = $children->language->__toString(); $type = $children->type->__toString(); $creator = $children->creator->__toString(); $modified = $children->modified->__toString(); var_dump($identifier, $title, $language, $type, $creator, $modified); } if ($recordChild->getName() === "owmsmantel") { $isFormatOf = $children->isFormatOf->__toString(); $alternative = $children->alternative->__toString(); $source = $children->source->__toString(); $isRatifiedBy = $children->isRatifiedBy->__toString(); $subject = $children->subject->__toString(); $issued = $children->issued->__toString(); var_dump($isFormatOf, $alternative, $source, $isRatifiedBy, $subject, $isFormatOf); } } }
Output for 7.0.0
Parse error: syntax error, unexpected '<', expecting end of file in /in/6QVZ3 on line 3
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Parse error: syntax error, unexpected '<' in /in/6QVZ3 on line 3
Process exited with code 255.