3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test( $input) { $doc = new DOMDocument; print_r($input); /* $doc->loadHTML( $input); $p = $doc->getElementsByTagName('a'); //->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.0100.01016.47
8.3.50.0090.00722.11
8.3.40.0040.01118.78
8.3.30.0070.00718.92
8.3.20.0040.00420.32
8.3.10.0000.00723.78
8.3.00.0000.00820.84
8.2.180.0000.01516.38
8.2.170.0140.00722.96
8.2.160.0060.01320.52
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0000.00820.73
8.2.110.0030.00622.16
8.2.100.0060.00617.78
8.2.90.0050.00319.08
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0040.00417.68
8.2.50.0090.00018.07
8.2.40.0000.00821.01
8.2.30.0040.00418.10
8.2.20.0040.00417.56
8.2.10.0050.00218.09
8.2.00.0050.00517.54
8.1.280.0080.00625.92
8.1.270.0060.00323.83
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.05
8.1.230.0110.00019.10
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0040.00817.10
8.1.180.0080.00018.10
8.1.170.0000.00918.54
8.1.160.0000.00721.95
8.1.150.0080.00018.67
8.1.140.0020.00517.34
8.1.130.0050.00217.79
8.1.120.0070.00017.50
8.1.110.0070.00017.39
8.1.100.0080.00017.47
8.1.90.0070.00017.42
8.1.80.0040.00417.44
8.1.70.0000.00817.35
8.1.60.0000.00817.59
8.1.50.0000.00717.59
8.1.40.0040.00417.46
8.1.30.0020.00517.59
8.1.20.0040.00417.76
8.1.10.0040.00417.54
8.1.00.0050.00617.43
8.0.300.0070.00018.77
8.0.290.0080.00017.18
8.0.280.0000.00718.32
8.0.270.0000.00717.30
8.0.260.0030.00317.35
8.0.250.0000.00816.88
8.0.240.0070.00016.95
8.0.230.0070.00016.87
8.0.220.0030.00316.77
8.0.210.0000.00716.88
8.0.200.0030.00316.93
8.0.190.0040.00416.92
8.0.180.0070.00016.92
8.0.170.0050.00316.86
8.0.160.0000.00816.84
8.0.150.0070.00016.77
8.0.140.0070.00016.86
8.0.130.0040.00413.33
8.0.120.0050.00216.86
8.0.110.0070.00016.87
8.0.100.0030.00516.92
8.0.90.0000.00716.71
8.0.80.0040.01216.81
8.0.70.0050.00316.93
8.0.60.0040.00416.98
8.0.50.0050.00316.85
8.0.30.0040.01617.20
8.0.20.0110.00817.40
8.0.10.0070.00017.03
8.0.00.0060.01116.98
7.4.330.0000.00515.00
7.4.320.0080.00016.53
7.4.300.0000.00616.64
7.4.290.0030.00316.66
7.4.280.0070.00016.54
7.4.270.0000.00716.75
7.4.260.0040.00416.54
7.4.250.0000.00816.55
7.4.240.0030.00516.48
7.4.230.0070.00016.73
7.4.220.0100.00716.50
7.4.210.0050.01016.58
7.4.200.0000.00716.34
7.4.190.0040.00416.51
7.4.160.0130.00316.27
7.4.150.0110.01417.40
7.4.140.0070.01417.86
7.4.130.0120.00816.51
7.4.120.0110.00816.54
7.4.110.0160.00616.37
7.4.100.0070.01116.66
7.4.90.0060.01216.43
7.4.80.0120.00919.39
7.4.70.0120.00416.55
7.4.60.0110.00616.49
7.4.50.0050.00316.29
7.4.40.0040.01216.42
7.4.30.0100.01016.25
7.4.10.0120.00614.72
7.4.00.0070.01014.77
7.3.330.0030.00213.24
7.3.320.0060.00013.18
7.3.310.0000.00716.30
7.3.300.0000.00716.32
7.3.290.0120.00616.34
7.3.280.0090.00516.25
7.3.270.0130.00417.40
7.3.260.0100.00616.25
7.3.250.0130.00416.56
7.3.240.0150.00916.40
7.3.230.0080.00816.40
7.3.210.0120.00616.27
7.3.200.0040.01819.39
7.3.190.0100.00716.23
7.3.180.0090.01216.64
7.3.170.0160.00016.31
7.3.160.0130.00316.60
7.3.130.0080.00814.73
7.3.120.0060.01114.75
7.3.110.0070.01014.82
7.3.100.0080.00514.45
7.3.90.0050.00814.68
7.3.80.0060.00714.61
7.3.70.0060.00614.68
7.3.60.0070.00714.61
7.3.50.0040.00814.78
7.3.40.0020.01014.57
7.3.30.0060.00514.61
7.3.20.0060.00816.54
7.3.10.0070.00616.65
7.3.00.0080.00616.51
7.2.330.0140.00416.52
7.2.320.0100.00716.74
7.2.310.0090.00616.73
7.2.300.0100.00716.39
7.2.290.0060.01216.76
7.2.260.0100.01014.88
7.2.250.0050.01214.76
7.2.240.0040.01215.10
7.2.230.0070.00914.89
7.2.220.0090.00414.92
7.2.210.0090.00415.06
7.2.200.0040.01114.82
7.2.190.0000.01414.86
7.2.180.0020.01114.92
7.2.170.0070.00514.88
7.2.160.0080.00414.98
7.2.150.0030.01116.91
7.2.140.0000.00916.77
7.2.130.0030.01116.65
7.2.120.0070.00716.87
7.2.110.0070.01016.85
7.2.100.0070.00417.01
7.2.90.0120.00316.88
7.2.80.0000.01516.91
7.2.70.0000.01516.78
7.2.60.0080.00816.82
7.2.50.0080.00516.83
7.2.40.0040.01116.75
7.2.30.0090.00616.89
7.2.20.0080.00416.88
7.2.10.0030.00916.80
7.2.00.0060.00316.81
7.1.330.0060.00915.73
7.1.320.0030.00615.75
7.1.310.0060.00715.68
7.1.300.0090.00615.71
7.1.290.0070.00715.71
7.1.280.0080.00615.60
7.1.270.0060.00715.58
7.1.260.0030.01015.68
7.1.250.0060.00615.57
7.1.240.0060.00315.78
7.1.230.0060.00615.90
7.1.220.0000.01415.77
7.1.210.0030.01215.46
7.1.200.0000.00815.70
7.1.190.0110.00015.70
7.1.180.0030.00915.58
7.1.170.0070.00715.52
7.1.160.0040.01115.80
7.1.150.0000.01715.47
7.1.140.0030.00915.66
7.1.130.0040.00715.75
7.1.120.0060.00915.79
7.1.110.0040.00415.88
7.1.100.0060.00615.61
7.1.90.0000.01015.79
7.1.80.0070.00715.88
7.1.70.0030.00716.28
7.1.60.0090.00917.63
7.1.50.0080.00316.29
7.1.40.0070.00715.73
7.1.30.0120.00015.80
7.1.20.0030.01015.91
7.1.10.0030.00915.54
7.1.00.0000.04519.04
7.0.330.0030.01215.22
7.0.320.0040.00415.40
7.0.310.0080.00015.41
7.0.300.0080.00415.35
7.0.290.0110.00715.09
7.0.280.0000.01015.57
7.0.270.0000.01015.28
7.0.260.0080.00515.52
7.0.250.0000.01315.30
7.0.240.0070.00715.34
7.0.230.0000.01215.41
7.0.220.0030.01015.04
7.0.210.0040.00815.44
7.0.200.0040.00416.09
7.0.190.0090.00315.43
7.0.180.0030.01015.48
7.0.170.0080.00615.48
7.0.160.0050.00315.25
7.0.150.0090.00315.37
7.0.140.0030.04018.79
7.0.130.0050.00515.51
7.0.120.0040.00915.32
7.0.110.0040.00415.50
7.0.100.0050.02317.68
7.0.90.0160.04617.67
7.0.80.0080.04717.64
7.0.70.0180.04517.65
7.0.60.0030.04217.65
7.0.50.0050.04517.79
7.0.40.0080.04316.80
7.0.30.0050.04416.73
7.0.20.0100.04316.64
7.0.10.0090.03316.75
7.0.00.0100.04216.65
5.6.400.0000.00914.24
5.6.390.0030.01214.44
5.6.380.0090.00314.29
5.6.370.0070.00714.49
5.6.360.0130.00014.46
5.6.350.0070.00714.35
5.6.340.0030.00914.03
5.6.330.0070.00714.19
5.6.320.0070.00714.23
5.6.310.0070.00714.12
5.6.300.0080.00414.57
5.6.290.0070.01014.03
5.6.280.0080.03717.57
5.6.270.0060.01014.43
5.6.260.0000.00914.46
5.6.250.0030.04417.41
5.6.240.0060.04617.63
5.6.230.0030.04617.36
5.6.220.0080.04717.35
5.6.210.0080.04317.63
5.6.200.0070.02517.65
5.6.190.0050.04317.73
5.6.180.0050.03117.80
5.6.170.0030.04217.66
5.6.160.0070.04017.62
5.6.150.0060.04617.45
5.6.140.0140.04317.82
5.6.130.0080.04217.60
5.6.120.0050.04317.63
5.6.110.0080.04117.71
5.6.100.0070.04617.61
5.6.90.0050.04917.54
5.6.80.0120.04017.29
5.6.70.0050.03417.26
5.6.60.0040.04717.18
5.6.50.0070.03717.18
5.6.40.0020.04617.36
5.6.30.0070.03917.31
5.6.20.0050.04217.49
5.6.10.0040.04417.39
5.6.00.0070.02817.30
5.5.380.0100.04017.29
5.5.370.0070.03817.37
5.5.360.0130.03817.16
5.5.350.0080.04617.26
5.5.340.0100.04317.54
5.5.330.0030.04817.36
5.5.320.0100.04217.59
5.5.310.0050.03717.49
5.5.300.0110.04317.59
5.5.290.0050.05117.66
5.5.280.0120.03217.39
5.5.270.0130.02517.60
5.5.260.0080.02617.49
5.5.250.0090.04217.48
5.5.240.0100.04417.05
5.5.230.0100.04217.30
5.5.220.0050.04717.16
5.5.210.0050.04017.21
5.5.200.0100.04017.24
5.5.190.0070.03717.10
5.5.180.0070.04017.14
5.5.170.0050.00513.97
5.5.160.0060.03017.26
5.5.150.0110.04117.24
5.5.140.0050.04217.13
5.5.130.0090.04217.16
5.5.120.0130.02817.11
5.5.110.0030.03617.14
5.5.100.0020.02917.00
5.5.90.0040.04417.20
5.5.80.0050.03616.98
5.5.70.0110.03817.29
5.5.60.0060.03617.21
5.5.50.0070.03917.13
5.5.40.0070.04216.93
5.5.30.0070.04017.05
5.5.20.0050.04417.06
5.5.10.0030.02917.16
5.5.00.0080.03817.07
5.4.450.0070.04216.23
5.4.440.0080.04116.27
5.4.430.0060.04616.23
5.4.420.0020.02616.19
5.4.410.0030.02516.21
5.4.400.0080.03816.07
5.4.390.0050.04016.13
5.4.380.0030.04016.00
5.4.370.0070.02516.15
5.4.360.0050.04216.14
5.4.350.0050.04016.08
5.4.340.0060.03016.13
5.4.330.0000.00613.10
5.4.320.0080.04016.07
5.4.310.0050.03916.12
5.4.300.0050.04316.08
5.4.290.0070.04016.02
5.4.280.0050.04316.07
5.4.270.0030.04216.07
5.4.260.0090.03516.10
5.4.250.0050.04316.11
5.4.240.0080.03116.11
5.4.230.0080.03516.06
5.4.220.0080.02816.07
5.4.210.0080.03816.11
5.4.200.0070.04016.07
5.4.190.0080.04016.11
5.4.180.0070.02015.97
5.4.170.0020.04416.02
5.4.160.0050.04216.15
5.4.150.0020.04516.13
5.4.140.0050.03814.76
5.4.130.0080.04114.76
5.4.120.0120.01714.78
5.4.110.0050.04214.77
5.4.100.0050.03714.77
5.4.90.0130.03314.77
5.4.80.0070.03214.79
5.4.70.0070.02014.71
5.4.60.0060.03614.73
5.4.50.0060.03614.75
5.4.40.0070.03514.73
5.4.30.0070.02214.77
5.4.20.0060.03314.78
5.4.10.0110.02714.75
5.4.00.0070.03714.49
5.3.290.0100.03513.91
5.3.280.0100.03113.83
5.3.270.0050.03013.88
5.3.260.0080.03913.84
5.3.250.0070.04413.82
5.3.240.0030.04013.84
5.3.230.0030.03913.82
5.3.220.0000.02913.80
5.3.210.0030.03813.89
5.3.200.0060.03113.78
5.3.190.0100.04013.82
5.3.180.0080.02613.86
5.3.170.0030.04113.83
5.3.160.0080.02213.88
5.3.150.0000.04813.79
5.3.140.0060.03813.86
5.3.130.0050.02713.88
5.3.120.0050.03813.81
5.3.110.0070.04213.80
5.3.100.0030.02913.53
5.3.90.0050.03313.57
5.3.80.0050.04113.62
5.3.70.0050.03813.58
5.3.60.0030.04413.60
5.3.50.0050.02313.55
5.3.40.0050.04113.56
5.3.30.0030.03813.55
5.3.20.0030.03013.41
5.3.10.0070.03313.37
5.3.00.0020.03713.42
5.2.170.0100.05011.76
5.2.160.0030.05011.76
5.2.150.0030.06311.76
5.2.140.0030.06011.76
5.2.130.0000.07011.76
5.2.120.0170.02311.76
5.2.110.0030.06311.76
5.2.100.0100.03711.76
5.2.90.0070.04711.76
5.2.80.0070.06311.76
5.2.70.0100.04711.76
5.2.60.0030.07011.76
5.2.50.0070.06311.76
5.2.40.0070.06011.76
5.2.30.0030.05711.76
5.2.20.0000.03711.76
5.2.10.0070.03711.76
5.2.00.0030.03311.76
5.1.60.0030.04011.76
5.1.50.0000.05711.76
5.1.40.0030.03711.76
5.1.30.0000.05311.76
5.1.20.0070.05011.76
5.1.10.0070.05311.76
5.1.00.0000.03011.76
5.0.50.0100.02311.76
5.0.40.0000.04011.76
5.0.30.0030.06311.76
5.0.20.0030.02311.76
5.0.10.0030.03011.76
5.0.00.0000.06311.76
4.4.90.0030.03711.76
4.4.80.0030.03311.76
4.4.70.0000.02011.76
4.4.60.0030.01311.76
4.4.50.0000.03311.76
4.4.40.0030.03011.76
4.4.30.0030.03311.76
4.4.20.0070.02011.76
4.4.10.0000.02011.76
4.4.00.0030.05311.76
4.3.110.0030.01711.76
4.3.100.0070.02711.76
4.3.90.0000.03011.76
4.3.80.0000.03011.76
4.3.70.0000.01711.76
4.3.60.0030.03711.76
4.3.50.0000.02711.76
4.3.40.0000.04711.76
4.3.30.0000.03311.76
4.3.20.0070.03311.76
4.3.10.0000.03711.76
4.3.00.0030.03311.76

preferences:
43.65 ms | 401 KiB | 5 Q