3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<img alt="äöü" class="foo" src="bar"><a href="target1">link text 1</a><a class="foo" src="target2">link text 2</a><div class="foo">xxx</div>'; $contentType = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; $doc = new DOMDocument('1.0'); $doc->loadHTML($contentType . $html, LIBXML_NOERROR); $xp = new DOMXPath($doc); foreach ($xp->query('//*[contains(@class, "foo") and (self::a or self::img)]') as $el) { echo $el->ownerDocument->saveHTML($el) . PHP_EOL; }

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.20.0090.00920.62
8.5.10.0100.00917.16
8.5.00.0130.01020.37
8.4.170.0110.01120.65
8.4.160.0150.00824.09
8.4.150.0020.00014.05
8.4.140.0150.00617.74
8.4.130.0100.00418.45
8.4.120.0060.00320.83
8.4.110.0120.00722.50
8.4.100.0120.00919.23
8.4.90.0120.00821.03
8.4.80.0120.00719.16
8.4.70.0110.00919.28
8.4.60.0180.00618.98
8.4.50.0100.01018.73
8.4.40.0100.01018.25
8.4.30.0040.01220.90
8.4.20.0040.01518.12
8.4.10.0130.00619.84
8.3.300.0130.00720.88
8.3.290.0140.00621.16
8.3.280.0090.01118.75
8.3.270.0110.00817.09
8.3.260.0090.00716.79
8.3.250.0110.00919.36
8.3.240.0110.00719.10
8.3.230.0070.00216.71
8.3.220.0110.00719.40
8.3.210.0050.00317.03
8.3.200.0050.00416.80
8.3.190.0090.01017.29
8.3.180.0060.00319.29
8.3.170.0160.00320.89
8.3.160.0150.00317.44
8.3.150.0110.00719.21
8.3.140.0110.00016.93
8.3.130.0090.00616.77
8.3.120.0000.01019.40
8.3.110.0040.00417.25
8.3.100.0040.00416.96
8.3.90.0110.01126.77
8.3.80.0100.00018.63
8.3.70.0140.00717.00
8.3.60.0120.00918.65
8.3.50.0210.00018.64
8.3.40.0100.00722.23
8.3.30.0070.00720.51
8.3.20.0030.01725.66
8.3.10.0070.01125.66
8.3.00.0100.01025.66
8.2.300.0120.00919.30
8.2.290.0130.00620.72
8.2.280.0100.00918.77
8.2.270.0140.00417.81
8.2.260.0130.00618.84
8.2.250.0060.00317.00
8.2.240.0030.00617.89
8.2.230.0110.00020.94
8.2.220.0090.00017.14
8.2.210.0090.00926.77
8.2.200.0030.00618.66
8.2.190.0040.01119.04
8.2.180.0100.01017.00
8.2.170.0110.00719.27
8.2.160.0090.00622.96
8.2.150.0100.01025.66
8.2.140.0090.00625.66
8.2.130.0080.00825.66
8.2.120.0120.00925.66
8.2.110.0040.01125.66
8.2.100.0120.00325.66
8.2.90.0040.01225.66
8.2.80.0130.00725.66
8.2.70.0190.00025.66
8.2.60.0040.01225.66
8.2.50.0150.00025.66
8.2.40.0040.01125.66
8.2.30.0090.00625.66
8.2.20.0110.00425.66
8.2.10.0150.00325.66
8.2.00.0090.00625.66
8.1.340.0140.00620.15
8.1.330.0050.00722.56
8.1.320.0100.00916.45
8.1.310.0070.00318.93
8.1.300.0000.00816.57
8.1.290.0030.00630.84
8.1.280.0160.00025.92
8.1.270.0090.00625.66
8.1.260.0000.01525.66
8.1.250.0070.00725.66
8.1.240.0130.00325.66
8.1.230.0070.01025.66
8.1.220.0100.00725.66
8.1.210.0160.00025.66
8.1.200.0140.00425.66
8.1.190.0070.01125.66
8.1.180.0100.00625.66
8.1.170.0060.00925.66
8.1.160.0060.00925.66
8.1.150.0110.00325.66
8.1.140.0090.00625.66
8.1.130.0110.00325.66
8.1.120.0120.00325.66
8.1.110.0000.01425.66
8.1.100.0150.00425.66
8.1.90.0120.00325.66
8.1.80.0190.00025.66
8.1.70.0130.00625.66
8.1.60.0150.00325.66
8.1.50.0080.00825.66
8.1.40.0140.00025.66
8.1.30.0060.00925.66
8.1.20.0060.00925.66
8.1.10.0090.00925.66
8.1.00.0140.00325.66

preferences:
86.49 ms | 403 KiB | 5 Q