3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test( $input) { $doc = new DOMDocument; $doc->loadHTML( $input); $p = $doc->getElementsByTagName('img'); print_r($p); //->item(0); /*$children = $p->childNodes; $img_found = false; $error = false; foreach( $children as $child) { if( $child->nodeType == XML_TEXT_NODE && !$img_found) { // Text before the image, OK, continue on continue; } if( $child->nodeType == XML_ELEMENT_NODE) { if( !($child->tagName == 'img')) { // echo "Invalid HTML element found"; $error = true; } else { $img_found = true; } } else { // echo "Invalid node type!"; $error = true; } } if( $img_found && !$error) { echo 'ok' . "\n"; } else { echo 'NOT ok' . "\n"; }*/ } $input = addslashes('<a href="http://inorbit.in/whitefield/wp-content/uploads/sites/4/2014/06/Interschool-championship.gif"><a href="http://inorbit.in/whitefield/wp-content/uploads/sites/4/2014/06/IMG_0889.jpg"><img class="aligncenter size-full wp-image-1928" alt="sports championship competition" src="http://inorbit.in/whitefield/wp-content/uploads/sites/4/2014/06/IMG_0889.jpg" width="1024" height="768" /></a><a href="http://inorbit.in/whitefield/wp-content/uploads/sites/4/2014/06/IMG_0830.jpg"><img class="aligncenter size-full wp-image-1929" alt="sports championship competition" src="http://inorbit.in/whitefield/wp-content/uploads/sites/4/2014/06/IMG_0830.jpg" width="1024" height="768" /></a></a>'); // ok test( $input);

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.3.60.0030.01616.88
8.3.50.0090.00822.03
8.3.40.0140.00018.96
8.3.30.0120.00319.33
8.3.20.0040.00420.54
8.3.10.0030.00523.86
8.3.00.0050.00321.14
8.2.180.0090.00917.13
8.2.170.0100.01022.96
8.2.160.0170.00320.77
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0050.00226.16
8.2.120.0050.00321.04
8.2.110.0070.00222.45
8.2.100.0060.00619.70
8.2.90.0040.00419.34
8.2.80.0050.00317.97
8.2.70.0030.00617.75
8.2.60.0060.00317.90
8.2.50.0040.00418.07
8.2.40.0000.00821.41
8.2.30.0040.00418.69
8.2.20.0040.00417.82
8.2.10.0040.00418.30
8.2.00.0090.00017.91
8.1.280.0060.00825.92
8.1.270.0040.00423.96
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0070.00324.21
8.1.230.0040.00719.60
8.1.220.0000.00817.80
8.1.210.0040.00418.77
8.1.200.0070.00317.47
8.1.190.0000.00817.60
8.1.180.0050.00318.10
8.1.170.0050.00318.93
8.1.160.0040.00422.35
8.1.150.0040.00418.84
8.1.140.0030.00617.64
8.1.130.0000.00818.01
8.1.120.0000.00817.64
8.1.110.0020.00517.71
8.1.100.0080.00017.52
8.1.90.0000.00717.57
8.1.80.0040.00417.73
8.1.70.0000.00717.59
8.1.60.0040.00417.81
8.1.50.0070.00017.75
8.1.40.0040.00417.75
8.1.30.0090.00017.85
8.1.20.0080.00017.94
8.1.10.0040.00417.82
8.1.00.0030.00717.58
8.0.300.0070.00018.77
8.0.290.0070.00017.30
8.0.280.0030.00318.66
8.0.270.0070.00017.38
8.0.260.0040.00417.32
8.0.250.0030.00417.24
8.0.240.0030.00517.16
8.0.230.0030.00317.28
8.0.220.0040.00417.18
8.0.210.0000.00717.17
8.0.200.0000.00617.18
8.0.190.0030.00617.16
8.0.180.0040.00417.10
8.0.170.0040.00417.12
8.0.160.0080.00017.07
8.0.150.0040.00417.15
8.0.140.0050.00317.00
8.0.130.0000.00813.56
8.0.120.0030.00517.13
8.0.110.0050.00217.05
8.0.100.0040.00416.93
8.0.90.0000.00717.03
8.0.80.0000.01717.05
8.0.70.0040.00416.93
8.0.60.0040.00416.96
8.0.50.0000.00717.14
8.0.30.0050.01417.38
8.0.20.0110.00717.40
8.0.10.0030.00517.13
8.0.00.0100.00816.86
7.4.330.0000.00615.00
7.4.320.0030.00316.71
7.4.300.0030.00316.83
7.4.290.0030.00516.83
7.4.280.0000.00716.76
7.4.270.0000.00716.73
7.4.260.0030.00516.87
7.4.250.0040.00416.75
7.4.240.0060.00216.80
7.4.230.0040.00416.64
7.4.220.0100.00716.80
7.4.210.0110.00916.76
7.4.200.0030.00317.00
7.4.190.0030.00316.72
7.4.160.0120.00316.52
7.4.150.0170.00317.40
7.4.140.0140.00817.86
7.4.130.0050.01216.76
7.4.120.0100.01116.72
7.4.110.0110.00616.48
7.4.100.0120.00916.86
7.4.90.0060.01016.55
7.4.80.0150.00819.39
7.4.70.0100.00616.55
7.4.60.0130.00716.68
7.4.50.0000.00816.51
7.4.40.0120.00416.64
7.4.30.0070.01017.00
7.4.00.0050.01015.18
7.3.330.0050.00013.35
7.3.320.0030.00313.49
7.3.310.0070.00016.43
7.3.300.0070.00016.46
7.3.290.0100.01016.56
7.3.280.0090.01016.50
7.3.270.0100.01017.40
7.3.260.0150.00916.88
7.3.250.0080.01016.50
7.3.240.0140.00616.51
7.3.230.0100.00716.61
7.3.210.0140.00316.76
7.3.200.0110.00919.39
7.3.190.0090.01216.87
7.3.180.0130.00716.59
7.3.170.0040.01116.66
7.3.160.0060.00916.62
7.3.120.0100.00814.89
7.3.110.0070.01115.02
7.3.100.0000.01514.96
7.3.90.0150.00415.15
7.3.80.0030.00914.94
7.3.70.0030.01014.97
7.3.60.0060.00714.87
7.3.50.0040.00414.87
7.3.40.0080.00414.79
7.3.30.0100.00314.93
7.3.20.0040.00716.79
7.3.10.0120.00316.49
7.3.00.0050.00816.73
7.2.330.0120.00616.78
7.2.320.0110.01116.93
7.2.310.0110.00716.74
7.2.300.0130.00316.85
7.2.290.0110.00716.75
7.2.250.0060.01014.97
7.2.240.0030.01715.10
7.2.230.0110.00414.77
7.2.220.0090.00915.17
7.2.210.0100.00614.86
7.2.200.0070.01115.16
7.2.190.0130.00014.95
7.2.180.0090.00314.90
7.2.170.0070.00714.84
7.2.60.0320.00416.44
7.1.330.0030.01016.01
7.1.320.0040.00815.74
7.1.310.0060.01216.03
7.1.300.0080.00615.78
7.1.290.0070.00715.80
7.1.280.0030.01016.02
7.1.270.0110.00315.86
7.1.260.0100.00315.77
7.1.200.0000.01415.66
7.1.70.0040.00417.05
7.1.60.0110.01419.46
7.1.50.0070.01717.09
7.1.00.0100.07022.62
7.0.200.0000.00716.80
7.0.140.0030.07322.12
7.0.60.0030.08319.95
7.0.50.0100.07717.98
7.0.40.0030.08720.38
7.0.30.2130.04020.25
7.0.20.0230.07720.20
7.0.10.0130.04720.28
7.0.00.0070.08720.31
5.6.280.0100.07021.18
5.6.210.0100.05720.52
5.6.200.0100.07718.26
5.6.190.0000.08020.58
5.6.180.0170.03720.55
5.6.170.0230.05020.59
5.6.160.0100.06720.59
5.6.150.0070.05718.33
5.6.140.0030.08318.32
5.6.130.0030.04018.30
5.6.120.0170.04321.15
5.6.110.0130.06721.04
5.6.100.0070.09321.09
5.6.90.0100.05721.17
5.6.80.0000.07020.58
5.5.350.4200.04720.46
5.5.340.0030.06718.13
5.5.330.0170.07720.50
5.5.320.0230.04320.42
5.5.310.0470.06320.43
5.5.300.0100.07718.15
5.5.290.0030.08018.10
5.5.280.0130.05720.90
5.5.270.0070.07021.01
5.5.260.0130.07720.85
5.5.250.0070.07020.78
5.5.240.0000.05720.35
5.4.450.0170.04719.49
5.4.440.0130.04719.55
5.4.430.0430.04019.62
5.4.420.0070.05019.57
5.4.410.0200.05019.54
5.4.400.0200.04319.31
5.4.390.0100.05019.16
5.4.380.0200.06018.58
5.4.370.0200.05318.77
5.4.360.0230.04718.67
5.4.350.0230.05018.67
5.4.340.0230.04318.80
5.4.320.0030.03912.66
5.4.310.0060.03812.66
5.4.300.0060.03712.67
5.4.290.0140.04112.66
5.4.280.0080.04812.56
5.4.270.0080.04912.56
5.4.260.0110.04812.56
5.4.250.0100.04912.56
5.4.240.0110.04512.56
5.4.230.0110.03912.55
5.4.220.0050.04912.55
5.4.210.0080.04712.55
5.4.200.0090.04512.55
5.4.190.0080.04212.55
5.4.180.0040.03812.55
5.4.170.0070.03612.56
5.4.160.0060.03912.56
5.4.150.0050.03812.56
5.4.140.0080.03512.24
5.4.130.0130.04212.23
5.4.120.0040.03912.19
5.4.110.0030.03812.18
5.4.100.0120.03512.18
5.4.90.0070.03912.18
5.4.80.0070.03612.18
5.4.70.0090.03312.18
5.4.60.0030.03812.18
5.4.50.0090.03412.17
5.4.40.0070.03512.16
5.4.30.0080.03412.16
5.4.20.0080.04312.15
5.4.10.0090.04512.15
5.4.00.0070.04911.64
5.3.290.0060.04612.92
5.3.280.0130.03612.85
5.3.270.0070.04012.86
5.3.260.0090.05012.87
5.3.250.0080.03512.87
5.3.240.0060.03712.87
5.3.230.0040.04212.86
5.3.220.0080.04312.83
5.3.210.0060.04112.83
5.3.200.0080.03712.82
5.3.190.0060.03812.83
5.3.180.0080.03612.83
5.3.170.0080.03712.82
5.3.160.0070.03712.83
5.3.150.0050.03912.83
5.3.140.0060.03612.81
5.3.130.0060.03912.81
5.3.120.0080.03712.81
5.3.110.0030.04212.81
5.3.100.0040.04312.30
5.3.90.0060.03612.28
5.3.80.0030.03912.27
5.3.70.0060.03912.27
5.3.60.0050.03712.25
5.3.50.0070.03712.20
5.3.40.0070.03712.20
5.3.30.0040.03812.16
5.3.20.0050.03611.93
5.3.10.0070.03411.91
5.3.00.0040.03811.89
5.2.170.0040.0339.39
5.2.160.0060.0309.40
5.2.150.0030.0349.40
5.2.140.0050.0339.39
5.2.130.0050.0309.36
5.2.120.0030.0319.35
5.2.110.0030.0329.36
5.2.100.0110.0239.35
5.2.90.0030.0329.35
5.2.80.0010.0349.35
5.2.70.0050.0309.35
5.2.60.0040.0319.30
5.2.50.0080.0289.27
5.2.40.0060.0369.25
5.2.30.0080.0359.23
5.2.20.0030.0329.21
5.2.10.0080.0269.11
5.2.00.0080.0318.97
5.1.60.0070.0328.26
5.1.50.0090.0278.26
5.1.40.0050.0368.23
5.1.30.0120.0378.59
5.1.20.0030.0308.60
5.1.10.0090.0238.33
5.1.00.0080.0338.33
5.0.50.0050.0266.81
5.0.40.0020.0276.67
5.0.30.0030.0346.49
5.0.20.0030.0216.45
5.0.10.0030.0216.43
5.0.00.0030.0356.43
4.4.90.0030.0214.78
4.4.80.0030.0194.76
4.4.70.0060.0134.75
4.4.60.0050.0174.75
4.4.50.0020.0164.77
4.4.40.0020.0334.71
4.4.30.0020.0204.76
4.4.20.0040.0204.84
4.4.10.0040.0184.85
4.4.00.0010.0264.76
4.3.110.0030.0154.67
4.3.100.0030.0154.66
4.3.90.0030.0164.63
4.3.80.0030.0264.59
4.3.70.0020.0174.63
4.3.60.0040.0204.63
4.3.50.0060.0194.62
4.3.40.0040.0344.54
4.3.30.0000.0183.30
4.3.20.0030.0163.27
4.3.10.0010.0173.24
4.3.00.0030.01713.84

preferences:
42.76 ms | 401 KiB | 5 Q