3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test( $input) { $doc = new DOMDocument; $doc->loadHTML( $input); $p = $doc->getElementsByTagName('a'); 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.0120.00317.00
8.3.50.0120.00522.13
8.3.40.0110.00419.09
8.3.30.0000.01419.34
8.3.20.0090.00020.56
8.3.10.0080.00023.89
8.3.00.0040.00421.15
8.2.180.0060.00917.00
8.2.170.0140.00722.96
8.2.160.0110.01120.57
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0020.00526.16
8.2.120.0060.00320.93
8.2.110.0050.00522.47
8.2.100.0040.00818.09
8.2.90.0080.00019.34
8.2.80.0000.00817.97
8.2.70.0050.00317.75
8.2.60.0080.00018.30
8.2.50.0060.00318.07
8.2.40.0000.00921.22
8.2.30.0090.00018.66
8.2.20.0040.00417.91
8.2.10.0040.00418.18
8.2.00.0040.00417.89
8.1.280.0030.01025.92
8.1.270.0030.00524.09
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00724.17
8.1.230.0110.00019.34
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0070.00317.73
8.1.190.0080.00017.47
8.1.180.0030.00518.10
8.1.170.0000.00818.94
8.1.160.0030.00622.08
8.1.150.0080.00018.81
8.1.140.0060.00317.57
8.1.130.0030.00518.14
8.1.120.0070.00017.66
8.1.110.0040.00417.63
8.1.100.0040.00417.58
8.1.90.0000.00717.69
8.1.80.0070.00017.60
8.1.70.0020.00517.60
8.1.60.0080.00017.82
8.1.50.0060.00317.82
8.1.40.0080.00017.77
8.1.30.0040.00417.92
8.1.20.0040.00417.92
8.1.10.0040.00417.76
8.1.00.0000.00917.68
8.0.300.0050.00318.77
8.0.290.0040.00417.68
8.0.280.0000.00718.66
8.0.270.0030.00317.55
8.0.260.0030.00317.32
8.0.250.0030.00317.21
8.0.240.0000.00817.19
8.0.230.0030.00317.11
8.0.220.0030.00317.15
8.0.210.0000.00717.05
8.0.200.0000.00617.14
8.0.190.0040.00417.14
8.0.180.0000.00717.09
8.0.170.0000.00917.18
8.0.160.0070.00017.14
8.0.150.0000.00717.08
8.0.140.0040.00417.14
8.0.130.0030.00313.63
8.0.120.0040.00417.06
8.0.110.0040.00417.07
8.0.100.0070.00017.25
8.0.90.0040.00417.03
8.0.80.0090.00617.18
8.0.70.0000.00817.09
8.0.60.0070.00017.23
8.0.50.0060.00317.21
8.0.30.0100.00917.34
8.0.20.0040.01617.42
8.0.10.0080.00017.39
8.0.00.0110.00917.03
7.4.330.0050.00015.00
7.4.320.0060.00016.64
7.4.300.0030.00316.79
7.4.290.0000.00716.77
7.4.280.0000.00716.84
7.4.270.0030.00316.94
7.4.260.0040.00416.85
7.4.250.0000.00716.71
7.4.240.0020.00616.88
7.4.230.0000.00816.76
7.4.220.0060.01216.93
7.4.210.0050.01116.92
7.4.200.0050.00316.89
7.4.190.0070.00016.83
7.4.160.0090.00617.11
7.4.150.0190.00317.40
7.4.140.0170.00217.86
7.4.130.0080.00816.84
7.4.120.0090.00916.71
7.4.110.0180.00016.75
7.4.100.0090.00916.89
7.4.90.0350.02316.79
7.4.80.0140.00919.39
7.4.70.0070.01016.78
7.4.60.0120.00816.71
7.4.50.0000.00716.54
7.4.40.0060.01116.42
7.4.30.0140.00316.42
7.4.00.0020.01414.96
7.3.330.0030.00313.44
7.3.320.0040.00413.49
7.3.310.0070.00016.56
7.3.300.0030.00516.41
7.3.290.0030.01216.57
7.3.280.0070.01116.48
7.3.270.0090.01217.40
7.3.260.0070.01116.50
7.3.250.0120.00516.59
7.3.240.0100.00716.71
7.3.230.0110.00616.54
7.3.210.0090.01216.59
7.3.200.0070.01419.39
7.3.190.0090.01216.64
7.3.180.0140.00416.46
7.3.170.0000.01616.84
7.3.160.0060.00916.75
7.3.120.0100.00614.94
7.3.110.0030.01314.86
7.3.100.0030.01315.01
7.3.90.0060.00915.03
7.3.80.0050.01014.98
7.3.70.0080.00514.77
7.3.60.0040.00914.79
7.3.50.0090.00514.78
7.3.40.0090.00114.68
7.3.30.0020.01314.96
7.3.20.0090.00716.57
7.3.10.0090.00616.40
7.3.00.0100.00516.61
7.2.330.0100.01416.65
7.2.320.0100.00717.05
7.2.310.0100.00716.95
7.2.300.0100.01316.64
7.2.290.0120.01216.96
7.2.250.0110.00615.22
7.2.240.0040.01615.06
7.2.230.0050.00815.06
7.2.220.0050.00815.03
7.2.210.0090.00715.13
7.2.200.0100.00515.01
7.2.190.0050.01014.99
7.2.180.0050.00815.13
7.2.170.0060.00614.79
7.2.160.0080.00414.91
7.2.150.0070.00716.89
7.2.140.0060.00316.47
7.2.130.0140.00816.77
7.2.120.0120.00916.90
7.2.110.0110.00916.69
7.2.100.0080.01116.82
7.2.90.0100.01016.83
7.2.80.0140.00416.50
7.2.70.0070.01116.77
7.2.60.0110.00716.93
7.2.50.0090.01116.72
7.2.40.0090.00816.75
7.2.30.0130.00916.75
7.2.20.0060.01216.58
7.2.10.0080.00716.51
7.2.00.0110.00416.68
7.1.330.0080.00915.84
7.1.320.0030.01215.88
7.1.310.0040.01016.06
7.1.300.0070.00515.84
7.1.290.0020.01315.64
7.1.280.0100.00315.77
7.1.270.0040.01115.70
7.1.260.0020.01415.79
7.1.250.0100.00715.76
7.1.240.0050.00915.73
7.1.230.0040.01016.02
7.1.220.0080.00315.79
7.1.210.0090.00615.69
7.1.200.0070.00915.92
7.1.190.0090.00515.74
7.1.180.0070.00915.68
7.1.170.0130.00315.90
7.1.160.0070.00715.73
7.1.150.0090.00615.69
7.1.140.0050.00715.72
7.1.130.0080.00815.89
7.1.120.0040.00615.68
7.1.110.0050.01015.93
7.1.100.0080.00515.94
7.1.90.0040.01115.67
7.1.80.0100.00315.81
7.1.70.0050.00716.30
7.1.60.0110.00916.94
7.1.50.0090.00716.20
7.1.40.0040.00615.76
7.1.30.0070.00715.73
7.1.20.0100.00615.89
7.1.10.0050.01015.78
7.1.00.0050.03018.12
7.0.330.0110.00415.30
7.0.320.0080.00715.52
7.0.310.0050.00915.43
7.0.300.0050.01115.38
7.0.290.0060.00715.43
7.0.280.0090.00515.48
7.0.270.0050.00915.39
7.0.260.0060.00615.25
7.0.250.0100.00515.22
7.0.240.0080.01015.28
7.0.230.0060.00815.38
7.0.220.0070.00415.27
7.0.210.0080.00515.37
7.0.200.0070.00415.95
7.0.190.0070.00615.49
7.0.180.0060.00515.44
7.0.170.0090.00715.43
7.0.160.0060.00915.54
7.0.150.0030.01015.46
7.0.140.0090.02617.62
7.0.130.0130.00215.52
7.0.120.0070.01015.54
7.0.110.0050.00915.31
7.0.100.0030.00815.30
7.0.90.0060.00715.44
7.0.80.0080.00815.43
7.0.70.0100.00815.38
7.0.60.0090.01916.92
7.0.50.0110.01716.27
7.0.40.0030.02615.70
7.0.30.0090.02015.82
7.0.20.0130.03215.78
7.0.10.0050.03215.79
7.0.00.0040.01915.78
5.6.400.0000.01014.80
5.6.390.0070.01014.48
5.6.380.0030.01314.31
5.6.370.0080.00814.39
5.6.360.0050.01014.35
5.6.350.0040.00914.20
5.6.340.0030.00714.31
5.6.330.0060.00514.37
5.6.320.0080.00514.52
5.6.310.0050.01114.66
5.6.300.0070.00914.57
5.6.290.0050.00714.34
5.6.280.0060.02916.52
5.6.270.0050.01014.50
5.6.260.0060.01014.35
5.6.250.0040.00714.33
5.6.240.0000.00814.33
5.6.230.0040.00914.38
5.6.220.0060.00614.00
5.6.210.0040.01916.14
5.6.200.0090.02615.70
5.6.190.0050.03616.29
5.6.180.0020.02416.36
5.6.170.0100.02116.28
5.6.160.0030.02216.50
5.6.150.0070.02015.72
5.6.140.0030.03615.51
5.6.130.0050.03315.54
5.6.120.0060.03116.45
5.6.110.0030.02016.61
5.6.100.0040.02116.51
5.6.90.0070.03016.73
5.6.80.0090.02716.38
5.6.70.0040.00814.17
5.6.60.0030.00714.28
5.6.50.0060.00414.51
5.6.40.0060.00714.33
5.6.30.0070.00414.16
5.6.20.0080.00914.04
5.6.10.0080.00714.19
5.6.00.0100.00614.01
5.5.380.0030.00612.88
5.5.370.0090.00412.91
5.5.360.0060.00512.96
5.5.350.1400.01515.37
5.5.340.0020.03414.68
5.5.330.0080.01915.38
5.5.320.0130.03015.46
5.5.310.0140.03015.46
5.5.300.0040.03214.65
5.5.290.0090.03014.68
5.5.280.0050.01915.63
5.5.270.0040.03315.71
5.5.260.0030.02515.65
5.5.250.0080.01815.50
5.5.240.0030.03115.36
5.5.230.0070.00412.81
5.5.220.0020.01312.89
5.5.210.0020.01213.01
5.5.200.0030.00913.01
5.5.190.0040.00712.96
5.5.180.0060.00512.96
5.5.170.0060.00712.81
5.5.160.0060.00412.93
5.5.150.0040.00812.90
5.5.140.0020.00812.91
5.5.130.0060.00612.86
5.5.120.0040.00612.96
5.5.110.0020.01012.97
5.5.100.0050.00813.02
5.5.90.0090.00212.74
5.5.80.0050.00612.88
5.5.70.0060.00412.87
5.5.60.0050.00512.85
5.5.50.0030.01012.90
5.5.40.0020.01113.03
5.5.30.0070.00712.89
5.5.20.0050.00712.79
5.5.10.0030.01012.76
5.5.00.0050.00612.96
5.4.450.0110.01714.19
5.4.440.0110.02014.08
5.4.430.0170.01714.08
5.4.420.0130.01514.11
5.4.410.0120.02013.91
5.4.400.0130.01913.92
5.4.390.0060.02313.93
5.4.380.0090.02813.77
5.4.370.0110.01813.67
5.4.360.0150.02513.88
5.4.350.0070.02213.79
5.4.340.0110.02013.69
5.4.330.0090.00211.32
5.4.320.0080.01611.74
5.4.310.0030.02011.75
5.4.300.0040.01811.84
5.4.290.0050.01811.65
5.4.280.0070.01311.66
5.4.270.0050.01611.69
5.4.260.0070.01611.65
5.4.250.0060.01711.74
5.4.240.0050.01511.68
5.4.230.0030.01811.70
5.4.220.0080.01511.67
5.4.210.0030.01911.61
5.4.200.0030.01911.72
5.4.190.0060.01511.73
5.4.180.0060.01711.65
5.4.170.0060.01611.74
5.4.160.0050.01611.65
5.4.150.0070.01611.74
5.4.140.0030.02411.64
5.4.130.0060.02011.73
5.4.120.0040.01711.62
5.4.110.0040.01711.55
5.4.100.0050.01811.55
5.4.90.0050.01711.61
5.4.80.0050.01911.68
5.4.70.0050.01811.55
5.4.60.0050.01611.64
5.4.50.0050.01511.64
5.4.40.0050.01611.63
5.4.30.0060.01811.63
5.4.20.0060.02411.55
5.4.10.0070.02111.63
5.4.00.0040.02311.47
5.3.290.0050.01711.77
5.3.280.0060.02111.60
5.3.270.0070.02111.74
5.3.260.0040.02211.71
5.3.250.0090.01911.66
5.3.240.0080.02111.62
5.3.230.0040.02411.68
5.3.220.0040.02411.59
5.3.210.0080.01911.68
5.3.200.0060.01611.70
5.3.190.0040.01711.61
5.3.180.0050.01711.74
5.3.170.0060.01511.74
5.3.160.0070.01511.69
5.3.150.0040.01611.72
5.3.140.0050.01711.70
5.3.130.0040.01911.63
5.3.120.0040.02111.72
5.3.110.0070.02111.66
5.3.100.0030.02211.53
5.3.90.0050.01911.54
5.3.80.0040.02011.48
5.3.70.0060.01811.44
5.3.60.0090.01611.52
5.3.50.0070.01811.39
5.3.40.0060.01811.49
5.3.30.0040.01911.49
5.3.20.0060.02911.37
5.3.10.0080.01611.29
5.3.00.0080.01611.34
5.2.170.0060.01610.50
5.2.160.0050.01810.50
5.2.150.0090.01710.50
5.2.140.0020.02010.50
5.2.130.0070.01410.48
5.2.120.0050.01710.48
5.2.110.0050.01610.48
5.2.100.0050.01810.48
5.2.90.0070.01610.48
5.2.80.0060.01710.48
5.2.70.0030.02110.48
5.2.60.0030.01710.45
5.2.50.0050.01610.44
5.2.40.0020.01810.43
5.2.30.0050.01710.41
5.2.20.0040.01810.41
5.2.10.0060.01610.36
5.2.00.0040.02010.29
5.1.60.0020.0169.93
5.1.50.0070.0129.93
5.1.40.0060.0179.92
5.1.30.0060.01710.09
5.1.20.0040.01810.10
5.1.10.0050.0159.97
5.1.00.0060.0169.97
5.0.50.0030.0139.21
5.0.40.0010.0159.14
5.0.30.0030.0199.04
5.0.20.0020.0159.03
5.0.10.0040.0119.02
5.0.00.0010.0199.01
4.4.90.0020.0108.19
4.4.80.0030.0108.18
4.4.70.0040.0088.18
4.4.60.0030.0098.18
4.4.50.0030.0098.19
4.4.40.0020.0168.15
4.4.30.0020.0118.18
4.4.20.0030.0098.22
4.4.10.0030.0108.23
4.4.00.0030.0158.18
4.3.110.0030.0148.13
4.3.100.0030.0108.13
4.3.90.0050.0108.12
4.3.80.0030.0138.09
4.3.70.0020.0098.12
4.3.60.0020.0118.11
4.3.50.0010.0118.12
4.3.40.0020.0148.07
4.3.30.0010.0097.45
4.3.20.0040.0097.44
4.3.10.0010.0127.42
4.3.00.0060.00712.72

preferences:
41.97 ms | 401 KiB | 5 Q