3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_tumbail($imgSrc,$placeholder_image){ $imgPattern = "/(http\:\/\/ww\d+\.sinaimg\.cn\/)(\w+)(\/\S+\.(jpg|gif))/i"; $matches = null; $result = preg_match($imgPattern, $imgSrc, $matches); if (!$result) { return $placeholder_image; } return $matches[1] . 'thumbnail' . $matches[3]; } $placeholder_image = 'images/transparent.gif'; $imgStr = '<img src="http://ww2.sinaimg.cn/bmiddle/a3d444e3jw1ez79amvdi1j20l50s8gpl.jpg"/>'; $imgStr = preg_replace_callback('#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#',function($match) { var_dump($match); global $placeholder_image; return sprintf('<img'.$match[1].'src="%s" data-original="'.$match[2].'" class="lazy"'.$match[3].'><noscript><img'.$match[1].'src="'.$match[2].'"'.$match[3].'></noscript>', get_tumbail($match[2],$placeholder_image)); },$imgStr); var_dump($imgStr); $imgStr = preg_replace('#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', sprintf('<img${1}src="%s" data-original="${2}" class="lazy"${3}><noscript><img${1}src="${2}"${3}></noscript>', get_tumbail(${2},$placeholder_image)), $imgStr); var_dump($imgStr);

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.00417.25
8.3.50.0110.00821.21
8.3.40.0110.00719.31
8.3.30.0090.00618.96
8.3.20.0040.00420.33
8.3.10.0080.00021.76
8.3.00.0070.01123.55
8.2.180.0100.00716.88
8.2.170.0040.01122.96
8.2.160.0100.00320.36
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00019.89
8.2.120.0080.00026.35
8.2.110.0040.00422.34
8.2.100.0040.00818.18
8.2.90.0000.00819.40
8.2.80.0080.00018.05
8.2.70.0000.00918.00
8.2.60.0030.00717.80
8.2.50.0080.00018.07
8.2.40.0080.00022.26
8.2.30.0040.00419.59
8.2.20.0000.00817.93
8.2.10.0000.00818.26
8.2.00.0050.00218.13
8.1.280.0150.00325.92
8.1.270.0040.00420.41
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0060.00322.41
8.1.230.0040.00719.23
8.1.220.0080.00017.78
8.1.210.0080.00018.77
8.1.200.0030.00717.50
8.1.190.0050.00317.60
8.1.180.0000.00818.10
8.1.170.0000.00818.74
8.1.160.0000.00720.82
8.1.150.0000.00718.94
8.1.140.0030.00619.67
8.1.130.0040.00417.80
8.1.120.0000.00717.57
8.1.110.0000.00717.54
8.1.100.0000.00817.61
8.1.90.0040.00417.66
8.1.80.0000.00717.50
8.1.70.0070.00017.65
8.1.60.0060.00317.80
8.1.50.0040.00417.72
8.1.40.0030.00617.71
8.1.30.0030.00617.83
8.1.20.0040.00417.87
8.1.10.0100.00017.63
8.1.00.0030.00617.72
8.0.300.0000.00718.77
8.0.290.0070.00017.00
8.0.280.0030.00318.52
8.0.270.0070.00017.23
8.0.260.0030.00317.23
8.0.250.0070.00017.15
8.0.240.0000.00817.12
8.0.230.0040.00417.21
8.0.220.0040.00417.09
8.0.210.0000.00717.05
8.0.200.0090.00017.16
8.0.190.0040.00417.07
8.0.180.0070.00017.07
8.0.170.0080.00017.06
8.0.160.0030.00617.12
8.0.150.0050.00217.12
8.0.140.0000.00716.99
8.0.130.0050.00013.50
8.0.120.0000.00817.16
8.0.110.0030.00617.11
8.0.100.0000.00817.27
8.0.90.0040.00417.03
8.0.80.0100.00717.26
8.0.70.0000.00817.10
8.0.60.0030.00517.17
8.0.50.0000.00717.14
8.0.30.0110.00517.44
8.0.20.0090.01017.40
8.0.10.0050.00317.21
8.0.00.0110.00817.02
7.4.330.0000.00616.87
7.4.320.0030.00316.84
7.4.300.0030.00316.77
7.4.290.0000.00716.81
7.4.280.0000.00816.82
7.4.270.0000.00816.77
7.4.260.0040.00416.94
7.4.250.0080.00016.64
7.4.240.0020.00716.87
7.4.230.0080.00016.92
7.4.220.0030.01317.00
7.4.210.0070.00916.94
7.4.200.0000.00716.82
7.4.160.0090.00916.93
7.4.150.0060.01217.40
7.4.140.0120.00717.86
7.4.130.0090.01016.79
7.4.120.0050.01416.80
7.4.110.0230.00316.89
7.4.100.0040.01516.92
7.4.90.0130.00617.09
7.4.80.0140.00319.39
7.4.70.0120.00616.98
7.4.60.0030.01316.99
7.4.50.0120.00416.87
7.4.40.0110.00716.65
7.4.30.0070.01116.63
7.4.00.0130.00315.07
7.3.330.0020.00213.38
7.3.320.0000.00513.41
7.3.310.0050.00316.38
7.3.300.0000.00716.42
7.3.290.0030.00316.57
7.3.280.0070.00916.58
7.3.270.0090.00917.40
7.3.260.0130.00616.54
7.3.250.0120.00716.63
7.3.240.0120.00816.62
7.3.230.0110.00816.79
7.3.210.0100.01316.77
7.3.200.0090.00919.39
7.3.190.0120.00616.54
7.3.180.0120.00616.81
7.3.170.0080.00816.87
7.3.160.0000.01516.82
7.3.120.0070.01014.95
7.3.110.0070.01115.12
7.3.100.0030.01314.76
7.3.90.0040.00715.07
7.3.80.0080.00615.26
7.3.70.0060.00614.73
7.3.60.0040.00815.01
7.3.50.0060.00914.73
7.3.40.0060.00614.74
7.3.30.0030.00615.14
7.3.20.0030.01316.71
7.3.10.0100.00716.84
7.3.00.0110.00416.88
7.2.330.0030.01516.80
7.2.320.0140.00816.82
7.2.310.0070.01017.05
7.2.300.0100.00716.76
7.2.290.0100.01116.61
7.2.250.0120.00615.11
7.2.240.0000.02115.45
7.2.230.0040.01115.11
7.2.220.0070.00415.13
7.2.210.0090.00615.43
7.2.200.0070.00314.98
7.2.190.0130.00314.95
7.2.180.0090.00615.33
7.2.170.0070.00315.24
7.2.00.0060.00319.74
7.1.330.0030.01015.96
7.1.320.0000.01015.85
7.1.310.0000.01615.81
7.1.300.0120.00016.05
7.1.290.0060.00916.11
7.1.280.0000.01115.71
7.1.270.0060.01016.15
7.1.260.0030.01315.81
7.1.100.0030.00918.11
7.1.70.0050.00317.46
7.1.60.0140.01019.20
7.1.50.0270.01035.10
7.1.00.0070.07322.57
7.0.200.0000.00716.98
7.0.60.0200.07021.76
7.0.50.0130.04717.95
7.0.40.0130.07320.29
7.0.30.0330.07320.28
7.0.20.0270.07020.19
7.0.10.0070.04020.12
7.0.00.0030.05020.14
5.6.280.0000.03721.03
5.6.210.0170.03020.71
5.6.200.0100.07718.18
5.6.190.0070.08020.56
5.6.180.0330.06720.61
5.6.170.0170.06320.54
5.6.160.0030.04020.47
5.6.150.0030.08318.18
5.6.140.0030.05318.15
5.6.130.0030.08718.18
5.6.120.0070.08321.00
5.6.110.0030.07720.90
5.6.100.0130.08021.02
5.6.90.0100.07720.96
5.6.80.0270.04720.41
5.5.350.0000.09020.44
5.5.340.0070.07018.04
5.5.330.0030.07720.30
5.5.320.0230.03720.40
5.5.310.0200.08320.23
5.5.300.0000.04717.98
5.5.290.0070.07318.09
5.5.280.0170.07720.78
5.5.270.0130.04720.87
5.5.260.0130.07320.90
5.5.250.0130.07720.57
5.5.240.0100.05020.17

preferences:
30.51 ms | 401 KiB | 5 Q