3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?> <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://www.accessdata.fda.gov/spl/schema/spl.xsd"> <component> <structuredBody> <component> <section ID="Lfba523bc-b21a-4a40-ae94-828271f8125f"> <id root="35e360f7-dc4d-5dd9-e054-00144ff88e88"/> <code code="51945-4" codeSystem="2.16.840.1.113883.6.1" displayName="PACKAGE LABEL.PRINCIPAL DISPLAY PANEL"/> <title>HERE IS TITLE 1</title> <text> <paragraph>This is Paragraph </paragraph> <paragraph>This is Paragraph 1</paragraph> <paragraph> <renderMultiMedia referencedObject="L30b39868-2c02-4f22-817f-3fc8ff059193"/> </paragraph> <paragraph>This is Paragraph 2</paragraph> <paragraph> <renderMultiMedia referencedObject="L7aa8dc60-ea4e-4c83-a8bd-ddf038c4b6bc"/> </paragraph> <paragraph>This is Paragraph 3</paragraph> <paragraph>This is Paragraph 4</paragraph> <paragraph> <renderMultiMedia referencedObject="L034834ef-4c2d-4d18-9fe0-7399530720ad"/> </paragraph> <paragraph/> </text> <effectiveTime value="20150909"/> <component> <observationMedia ID="L30b39868-2c02-4f22-817f-3fc8ff059193"> <text>image description</text> <value mediaType="image/jpeg" xsi:type="ED"> <reference value="Label1.jpg"/> </value> </observationMedia> </component> <component> <observationMedia ID="L7aa8dc60-ea4e-4c83-a8bd-ddf038c4b6bc"> <text>image description</text> <value mediaType="image/jpeg" xsi:type="ED"> <reference value="Label2.jpg"/> </value> </observationMedia> </component> <component> <observationMedia ID="L034834ef-4c2d-4d18-9fe0-7399530720ad"> <text>image description</text> <value mediaType="image/jpeg" xsi:type="ED"> <reference value="Label3.jpg"/> </value> </observationMedia> </component> </section> </component> </structuredBody> </component> </document> XML; // in DOM you load the XML into a document $document = new DOMDocument(); $document->loadXml($xml); // and create and Xpath object for it $xpath = new DOMxpath($document); // on this object you cen register aliases/prefixes for namespaces $xpath->registerNamespace('root', 'urn:hl7-org:v3'); // xpath expression with location paths return node lists that are iterable foreach ($xpath->evaluate('//root:section') as $component) { // but if you cast the result an Xpath expression can return a scalar value as well echo $xpath->evaluate('string(title)', $component), "\n"; // take note of the second argument, it defines the context for the xpath expression foreach($xpath->evaluate('.//root:paragraph', $component) as $paragraph) { // you can access attributes the same way, but attributes without a prefix are never in a namespace $referenceId = $xpath->evaluate('string(root:renderMultiMedia/@referencedObject)', $paragraph); if (empty($referenceId)) { // this will output the first text child node of the paragraph echo 'TEXT: ', $xpath->evaluate('string(text())', $paragraph), "\n"; } else { // expression that start with a / use the document context foreach ($xpath->evaluate("//root:observationMedia[@ID='{$referenceId}'][1]") as $reference) { echo 'REF:', $xpath->evaluate('string(root:value/root:reference/@value)', $reference), "\n"; } } } }

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.5.30.0110.01119.73
8.5.20.0120.01119.86
8.5.10.0180.00717.20
8.5.00.0130.01020.40
8.4.180.0150.00922.43
8.4.170.0110.01024.30
8.4.160.0090.01322.61
8.4.150.0070.00717.11
8.4.140.0100.01218.02
8.4.130.0060.00418.05
8.4.120.0110.01024.31
8.4.110.0140.00619.46
8.4.100.0150.00618.11
8.4.90.0110.01022.88
8.4.80.0060.00319.99
8.4.70.0110.00918.36
8.4.60.0110.01019.39
8.4.50.0110.01020.87
8.4.40.0150.00319.83
8.4.30.0060.00319.91
8.4.20.0100.01019.82
8.4.10.0030.00719.94
8.3.300.0090.01321.20
8.3.290.0090.01221.08
8.3.280.0120.01018.69
8.3.270.0090.01216.80
8.3.260.0130.00917.63
8.3.250.0120.00819.24
8.3.240.0060.01317.48
8.3.230.0090.00717.17
8.3.220.0050.00319.51
8.3.210.0100.01016.89
8.3.200.0050.00417.27
8.3.190.0060.00217.70
8.3.180.0090.01017.12
8.3.170.0050.00317.53
8.3.160.0070.01318.74
8.3.150.0000.00816.98
8.3.140.0040.00417.57
8.3.130.0070.01616.82
8.3.120.0090.00019.62
8.3.110.0030.00620.94
8.3.100.0090.00024.06
8.3.90.0090.00326.77
8.3.80.0070.01018.68
8.3.70.0090.00617.00
8.3.60.0100.00716.87
8.3.50.0100.00716.87
8.3.40.0160.00318.96
8.3.30.0090.00619.09
8.3.20.0050.00322.28
8.3.10.0060.00323.96
8.3.00.0030.00522.34
8.2.300.0050.01522.59
8.2.290.0150.00520.77
8.2.280.0100.00918.80
8.2.270.0080.01117.61
8.2.260.0070.01118.82
8.2.250.0030.00618.83
8.2.240.0090.00017.60
8.2.230.0090.00022.58
8.2.220.0030.01237.54
8.2.210.0170.00326.77
8.2.200.0030.00617.38
8.2.190.0160.00717.00
8.2.180.0080.00816.86
8.2.170.0060.00922.96
8.2.160.0100.01020.85
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0040.00421.44
8.2.120.0040.00426.35
8.2.110.0080.00319.95
8.2.100.0040.00818.34
8.2.90.0040.00818.53
8.2.80.0060.00318.53
8.2.70.0030.00518.40
8.2.60.0080.00017.88
8.2.50.0040.00418.42
8.2.40.0030.00621.05
8.2.30.0000.00721.02
8.2.20.0040.00418.47
8.2.10.0000.00818.51
8.2.00.0040.00418.66
8.1.340.0120.00822.08
8.1.330.0090.01022.23
8.1.320.0120.00916.57
8.1.310.0110.00718.73
8.1.300.0120.00620.30
8.1.290.0030.01030.84
8.1.280.0040.01125.92
8.1.270.0040.00422.57
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00720.84
8.1.230.0080.00321.41
8.1.220.0040.00418.17
8.1.210.0040.00419.21
8.1.200.0000.00917.73
8.1.190.0090.00017.63
8.1.180.0070.00318.10
8.1.170.0030.00619.09
8.1.160.0070.00019.33
8.1.150.0000.00822.39
8.1.140.0030.00618.18
8.1.130.0040.00419.60
8.1.120.0030.00717.98
8.1.110.0040.00417.96
8.1.100.0040.00417.70
8.1.90.0040.00417.79
8.1.80.0060.00317.97
8.1.70.0080.00017.82
8.1.60.0040.00418.11
8.1.50.0040.00417.89
8.1.40.0050.00317.81
8.1.30.0050.00318.17
8.1.20.0030.00518.17
8.1.10.0040.00418.06
8.1.00.0030.00518.06
8.0.300.0050.00320.48
8.0.290.0040.00417.25
8.0.280.0000.00718.89
8.0.270.0000.00717.69
8.0.260.0030.00517.28
8.0.250.0030.00317.52
8.0.240.0030.00617.36
8.0.230.0070.00317.55
8.0.220.0000.00817.46
8.0.210.0050.00217.48
8.0.200.0000.00717.55
8.0.190.0040.00417.31
8.0.180.0040.00417.48
8.0.170.0040.00717.49
8.0.160.0040.00417.36
8.0.150.0130.00017.43
8.0.140.0030.00617.21
8.0.130.0030.00513.93
8.0.120.0000.00817.45
8.0.110.0050.00317.30
8.0.100.0000.00717.30
8.0.90.0000.00917.32
8.0.80.0120.00617.37
8.0.70.0040.00417.28
8.0.60.0000.00717.38
8.0.50.0000.00817.38
8.0.30.0090.01017.56
8.0.20.0140.00617.65
8.0.10.0050.00317.52
8.0.00.0070.01017.29
7.4.330.0000.00515.59
7.4.320.0000.00617.12
7.4.300.0060.00016.85
7.4.290.0040.00417.01
7.4.280.0030.00617.14
7.4.270.0000.00717.04
7.4.260.0050.00317.00
7.4.250.0070.00016.94
7.4.240.0050.00317.08
7.4.230.0000.00717.08
7.4.220.0050.00317.04
7.4.210.0090.00616.97
7.4.200.0050.00316.91
7.4.160.0120.00516.94
7.4.140.0120.00617.86
7.4.130.0030.01516.96
7.4.120.0110.00816.94
7.4.110.0070.01417.10
7.4.100.0060.01216.88
7.4.90.0120.00616.96
7.4.80.0030.01619.39
7.4.70.0120.00616.93
7.4.60.0110.01316.82
7.4.50.0060.01017.14
7.4.40.0060.01216.86
7.4.00.0090.00815.14
7.3.330.0000.00513.61
7.3.320.0050.00013.58
7.3.310.0050.00316.91
7.3.300.0020.00516.76
7.3.290.0110.00616.83
7.3.280.0060.01116.75
7.3.260.0140.00616.79
7.3.240.0080.01117.04
7.3.230.0110.02316.74
7.3.210.0070.01016.88
7.3.200.0110.00716.75
7.3.190.0110.00816.98
7.3.180.0130.00617.04
7.3.170.0090.01216.85
7.3.160.0190.00416.71
7.3.120.0160.00315.10
7.3.110.0090.00915.18
7.3.100.0060.01014.93
7.3.90.0130.00014.73
7.3.80.0070.01014.95
7.3.70.0030.01015.22
7.3.60.0040.01415.08
7.3.50.0030.01015.12
7.3.40.0060.00914.93
7.3.30.0060.00615.05
7.3.20.0070.00716.71
7.3.10.0040.01117.02
7.3.00.0090.00617.06
7.2.330.0120.00617.09
7.2.320.0100.01417.13
7.2.310.0030.01417.05
7.2.300.0110.00717.01
7.2.290.0070.01116.97
7.2.250.0100.01015.18
7.2.240.0130.00315.40
7.2.230.0100.01015.12
7.2.220.0090.00615.21
7.2.210.0100.00715.27
7.2.200.0100.00314.93
7.2.190.0120.00415.14
7.2.180.0130.00315.38
7.2.170.0090.00915.21
7.2.60.0000.00917.12
7.2.30.0150.01318.46
7.2.20.0150.01418.14
7.2.10.0150.01518.26
7.2.00.0130.01418.29
7.1.330.0030.01316.00
7.1.320.0110.00715.82
7.1.310.0080.00815.88
7.1.300.0100.00716.13
7.1.290.0100.00715.86
7.1.280.0120.00315.98
7.1.270.0070.00716.13
7.1.260.0030.01316.10
7.1.200.0080.00415.93
7.1.150.0160.01417.02
7.1.140.0120.01216.87
7.1.130.0130.01317.32
7.1.120.0140.01517.04
7.1.110.0150.01016.46
7.1.100.0110.01116.40
7.1.90.0170.01416.40
7.1.80.0150.00716.48
7.1.70.0170.01315.73
7.1.60.0330.01133.24
7.1.50.0390.01633.17
7.1.40.0230.01632.74
7.1.30.0350.02032.84
7.1.20.0340.02232.89
7.1.10.0140.01015.05
7.1.00.0130.01315.18

preferences:
101.55 ms | 1560 KiB | 5 Q