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 = ' <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.0110.00717.00
8.3.50.0040.01122.17
8.3.40.0060.00918.92
8.3.30.0100.00319.32
8.3.20.0040.00420.54
8.3.10.0050.00323.89
8.3.00.0040.00421.27
8.2.180.0000.01617.00
8.2.170.0090.00622.96
8.2.160.0040.01120.75
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00421.08
8.2.110.0090.00022.38
8.2.100.0080.00417.97
8.2.90.0080.00019.34
8.2.80.0030.00517.97
8.2.70.0000.00817.75
8.2.60.0040.00418.16
8.2.50.0040.00418.07
8.2.40.0000.00821.36
8.2.30.0040.00418.51
8.2.20.0040.00417.82
8.2.10.0050.00318.27
8.2.00.0040.00418.00
8.1.280.0140.00025.92
8.1.270.0000.01024.21
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0120.00023.91
8.1.230.0040.00719.25
8.1.220.0000.00817.79
8.1.210.0060.00318.77
8.1.200.0030.00617.38
8.1.190.0000.00817.48
8.1.180.0040.00418.10
8.1.170.0040.00418.91
8.1.160.0000.00822.25
8.1.150.0050.00218.80
8.1.140.0000.00817.77
8.1.130.0000.00718.06
8.1.120.0040.00417.51
8.1.110.0040.00417.64
8.1.100.0040.00417.70
8.1.90.0000.00717.66
8.1.80.0060.00317.66
8.1.70.0070.00017.46
8.1.60.0080.00017.82
8.1.50.0050.00317.77
8.1.40.0040.00417.68
8.1.30.0040.00417.96
8.1.20.0000.00917.97
8.1.10.0000.01017.75
8.1.00.0030.00717.73
8.0.300.0000.00818.77
8.0.290.0000.00817.53
8.0.280.0030.00318.71
8.0.270.0000.00717.37
8.0.260.0030.00317.34
8.0.250.0030.00317.11
8.0.240.0040.00417.20
8.0.230.0070.00017.03
8.0.220.0050.00217.07
8.0.210.0050.00317.01
8.0.200.0000.00717.07
8.0.190.0000.00817.11
8.0.180.0000.00716.99
8.0.170.0080.00017.09
8.0.160.0000.00717.12
8.0.150.0000.00716.96
8.0.140.0040.00417.12
8.0.130.0000.00613.61
8.0.120.0040.00417.10
8.0.110.0040.00417.11
8.0.100.0000.00717.12
8.0.90.0050.00216.95
8.0.80.0060.00917.11
8.0.70.0000.00717.19
8.0.60.0040.00417.06
8.0.50.0000.00817.17
8.0.30.0110.00817.38
8.0.20.0140.00817.45
8.0.10.0050.00317.22
8.0.00.0080.00917.12
7.4.330.0060.00015.00
7.4.320.0000.00716.79
7.4.300.0030.00316.68
7.4.290.0000.00716.71
7.4.280.0040.00416.75
7.4.270.0000.00716.63
7.4.260.0000.00716.62
7.4.250.0000.00716.71
7.4.240.0000.00816.63
7.4.230.0040.00416.86
7.4.220.0060.01316.81
7.4.210.0110.00816.86
7.4.200.0030.00316.89
7.4.190.0000.00716.93
7.4.160.0090.00616.55
7.4.150.0090.00917.40
7.4.140.0140.00617.86
7.4.130.0090.00816.75
7.4.120.0090.01116.78
7.4.110.0070.01016.84
7.4.100.0120.00616.72
7.4.90.0080.00916.63
7.4.80.0120.00619.39
7.4.70.0090.00916.58
7.4.60.0060.01116.83
7.4.50.0050.00016.60
7.4.40.0100.00516.67
7.4.30.0040.01416.64
7.4.00.0060.01015.16
7.3.330.0000.00513.48
7.3.320.0050.00013.31
7.3.310.0000.00716.52
7.3.300.0050.00216.57
7.3.290.0140.00016.37
7.3.280.0090.00816.53
7.3.270.0090.00917.40
7.3.260.0100.00716.59
7.3.250.0090.01116.46
7.3.240.0030.01316.50
7.3.230.0070.01516.65
7.3.210.0150.00716.42
7.3.200.0090.01219.39
7.3.190.0150.00916.73
7.3.180.0130.01016.70
7.3.170.0120.00316.56
7.3.160.0110.00416.48
7.3.120.0030.01414.89
7.2.330.0100.01016.96
7.2.320.0070.01416.66
7.2.310.0060.01616.57
7.2.300.0060.01016.72
7.2.290.0160.00716.78
7.2.60.0030.01016.76
7.1.200.0100.00315.98
7.1.70.0030.00317.04
7.1.60.0100.01419.46
7.1.50.0070.01416.96
7.1.00.0000.08022.61
7.0.200.0030.00316.84
7.0.140.0070.07022.16
7.0.60.0100.04319.91
7.0.50.0030.04717.96
7.0.40.0000.08020.04
7.0.30.0130.04720.16
7.0.20.0330.06720.32
7.0.10.0100.09020.23
7.0.00.0070.07720.32
5.6.280.0070.07020.88
5.6.210.0030.04020.51
5.6.200.0070.05018.32
5.6.190.0100.06320.71
5.6.180.0170.05720.58
5.6.170.0330.08020.63
5.6.160.0100.05020.63
5.6.150.0100.07718.36
5.6.140.0030.04018.25
5.6.130.0100.03718.29
5.6.120.0130.07021.04
5.6.110.0100.03321.02
5.6.100.0100.03721.02
5.6.90.0100.08021.02
5.6.80.0070.07020.49
5.5.350.4070.04020.48
5.5.340.0030.04718.07
5.5.330.0070.06320.55
5.5.320.0270.08020.43
5.5.310.0330.05320.38
5.5.300.0100.07718.02
5.5.290.0170.06318.23
5.5.280.0170.07320.83
5.5.270.0030.07720.91
5.5.260.0000.07320.92
5.5.250.0000.04320.84
5.5.240.0070.05720.14
5.4.450.0200.03719.61
5.4.440.0130.04319.63
5.4.430.0100.07719.43
5.4.420.0130.07719.44
5.4.410.0200.07319.50
5.4.400.0230.06019.00
5.4.390.0300.06319.31
5.4.380.0200.03719.23
5.4.370.0200.07319.32
5.4.360.0200.05719.14
5.4.350.0270.05019.21
5.4.340.0170.06019.32
5.4.320.0170.08019.14
5.4.310.0130.05019.23
5.4.300.0170.04719.26
5.4.290.0130.06319.23
5.4.280.0130.08019.26
5.4.270.0270.05019.25
5.4.260.0230.05319.29
5.4.250.0270.05319.13
5.4.240.0270.04019.23
5.4.230.0200.04019.21
5.4.220.0130.05319.13
5.4.210.0100.06019.06
5.4.200.0130.06719.29
5.4.190.0130.04019.25
5.4.180.0200.05019.01
5.4.170.0130.05019.13
5.4.160.0170.06019.01
5.4.150.0200.04719.05
5.4.140.0300.02716.63
5.4.130.0200.07016.54
5.4.120.0330.04316.50
5.4.110.0200.05716.64
5.4.100.0200.07016.40
5.4.90.0130.05316.71
5.4.80.0170.04716.50
5.4.70.0170.04716.67
5.4.60.0200.05016.66
5.4.50.0230.03716.63
5.4.40.0200.07016.66
5.4.30.0200.05716.65
5.4.20.0300.05316.35
5.4.10.0270.04716.68
5.4.00.0170.03715.91
5.3.290.0270.07014.75
5.3.280.0300.07014.69
5.3.270.0170.05314.61
5.3.260.0200.05714.65
5.3.250.0170.03714.77
5.3.240.0170.04314.65
5.3.230.0130.04714.79
5.3.220.0200.06014.65
5.3.210.0230.06714.63
5.3.200.0330.06314.66
5.3.190.0200.04014.74
5.3.180.0130.04314.71
5.3.170.0170.03714.87
5.3.160.0330.05714.56
5.3.150.0230.05314.61
5.3.140.0230.07014.86
5.3.130.0200.05314.74
5.3.120.0170.05314.72
5.3.110.0370.06314.71
5.3.100.0200.07714.09
5.3.90.0270.05714.18
5.3.80.0300.05014.17
5.3.70.0170.06314.33
5.3.60.0300.05014.06
5.3.50.0200.05714.24
5.3.40.0330.05714.10
5.3.30.0300.06314.05
5.3.20.0330.06313.68
5.3.10.0230.04313.82
5.3.00.0270.06713.71
5.2.170.0230.05312.19
5.2.160.0270.05312.19
5.2.150.0130.06712.19
5.2.140.0170.06012.19
5.2.130.0130.06012.19
5.2.120.0130.05312.19
5.2.110.0130.03012.19
5.2.100.0230.05012.19
5.2.90.0170.05312.19
5.2.80.0130.03312.19
5.2.70.0270.05312.19
5.2.60.0230.05312.19
5.2.50.0170.05312.19
5.2.40.0170.05312.19
5.2.30.0230.05312.19
5.2.20.0200.04312.19
5.2.10.0200.03312.20
5.2.00.0170.05712.20
5.1.60.0130.02712.20
5.1.50.0070.05012.21
5.1.40.0200.03312.21
5.1.30.0200.05312.21
5.1.20.0170.04312.21
5.1.10.0170.04012.21
5.1.00.0170.03312.21
5.0.50.0100.04312.21
5.0.40.0200.02712.21
5.0.30.0070.03712.21
5.0.20.0070.04312.21
5.0.10.0070.04312.21
5.0.00.0070.06312.21
4.4.90.0100.03312.19
4.4.80.0070.03712.19
4.4.70.0100.02012.19
4.4.60.0070.02312.19
4.4.50.0170.01712.19
4.4.40.0070.05312.20
4.4.30.0030.02012.21
4.4.20.0070.03712.21
4.4.10.0300.01712.21
4.4.00.0100.05012.21
4.3.110.0030.03712.21
4.3.100.0070.01712.21
4.3.90.0100.03312.21
4.3.80.0070.05312.21
4.3.70.0130.02312.21
4.3.60.0070.01712.21
4.3.50.0170.01312.21
4.3.40.0130.02712.21
4.3.30.0100.01312.21
4.3.20.0000.01712.21
4.3.10.0070.01712.21
4.3.00.0070.03312.21

preferences:
40.96 ms | 401 KiB | 5 Q