3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'foo'; $replacement = 'bar'; $str1 = preg_replace_callback('/^foo$/', function($match) { global $replacement; return $replacement; }, $str); $str2 = preg_replace_callback('/^foo$/', function($match, &$replacement) { return $replacement; }, $str); var_dump($str1); var_dump($str2);

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.0140.00018.58
8.3.50.0140.00722.08
8.3.40.0150.00018.95
8.3.30.0070.00719.22
8.3.20.0040.00420.25
8.3.10.0080.00021.96
8.3.00.0040.00422.50
8.2.180.0090.01218.38
8.2.170.0070.00722.96
8.2.160.0070.00720.91
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0070.00326.16
8.2.120.0000.00817.88
8.2.110.0090.00022.08
8.2.100.0080.00417.88
8.2.90.0040.00419.17
8.2.80.0030.00519.77
8.2.70.0000.00817.88
8.2.60.0000.00717.93
8.2.50.0040.00418.07
8.2.40.0000.00718.22
8.2.30.0030.00618.14
8.2.20.0000.00717.95
8.2.10.0040.00419.74
8.2.00.0040.00417.94
8.1.280.0110.01125.92
8.1.270.0040.00423.73
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.70
8.1.230.0080.00419.04
8.1.220.0040.00417.76
8.1.210.0030.00618.77
8.1.200.0000.00917.48
8.1.190.0030.00717.52
8.1.180.0080.00018.10
8.1.170.0090.00018.59
8.1.160.0040.00422.06
8.1.150.0040.00418.84
8.1.140.0100.00017.66
8.1.130.0030.00317.87
8.1.120.0070.00017.59
8.1.110.0000.00717.66
8.1.100.0050.00317.52
8.1.90.0040.00417.54
8.1.80.0070.00017.68
8.1.70.0040.00417.57
8.1.60.0040.00417.80
8.1.50.0000.00817.67
8.1.40.0050.00317.74
8.1.30.0030.00617.75
8.1.20.0060.00317.86
8.1.10.0040.00417.64
8.1.00.0000.00717.71
8.0.300.0000.00718.77
8.0.290.0050.00317.15
8.0.280.0040.00418.42
8.0.270.0080.00017.18
8.0.260.0070.00017.02
8.0.250.0030.00317.10
8.0.240.0030.00317.13
8.0.230.0030.00317.15
8.0.220.0030.00317.03
8.0.210.0070.00016.95
8.0.200.0030.00317.14
8.0.190.0040.00417.17
8.0.180.0030.00517.14
8.0.170.0040.00416.97
8.0.160.0000.00817.05
8.0.150.0000.00817.02
8.0.140.0040.00417.00
8.0.130.0030.00513.61
8.0.120.0040.00416.98
8.0.110.0040.00417.03
8.0.100.0000.00717.14
8.0.90.0040.00417.11
8.0.80.0120.00317.11
8.0.70.0040.00417.08
8.0.60.0000.00717.07
8.0.50.0070.00017.07
8.0.30.0170.00317.13
8.0.20.0090.01117.40
8.0.10.0040.00417.11
8.0.00.0100.00717.23
7.4.330.0050.00315.00
7.4.320.0000.00616.75
7.4.300.0000.00616.64
7.4.290.0030.00616.83
7.4.280.0000.00716.65
7.4.270.0030.00316.86
7.4.260.0100.00016.73
7.4.250.0040.00416.60
7.4.240.0050.00316.80
7.4.230.0040.00416.78
7.4.220.0130.01316.77
7.4.210.0060.01016.77
7.4.200.0000.00716.80
7.4.190.0080.00016.92
7.4.160.0070.01016.60
7.4.150.0090.00917.40
7.4.140.0100.01017.86
7.4.130.0090.01116.74
7.4.120.0150.00416.83
7.4.110.0130.01016.85
7.4.100.0030.01716.83
7.4.90.0100.00716.77
7.4.80.0070.01119.39
7.4.70.0100.00616.63
7.4.60.0090.00616.63
7.4.50.0030.00316.84
7.4.40.0030.00822.77
7.4.30.0100.00716.79
7.4.00.0070.01115.25
7.3.330.0050.00013.28
7.3.320.0000.00513.44
7.3.310.0000.00716.36
7.3.300.0030.00316.34
7.3.290.0060.00916.47
7.3.280.0130.00616.47
7.3.270.0100.00717.40
7.3.260.0170.00716.73
7.3.250.0070.01216.69
7.3.240.0060.01116.70
7.3.230.0120.00916.39
7.3.210.0130.00316.57
7.3.200.0070.01019.39
7.3.190.0090.01316.53
7.3.180.0030.01316.53
7.3.170.0070.01016.50
7.3.160.0070.01416.48
7.3.120.0070.01014.95
7.3.10.0000.01316.56
7.3.00.0080.00716.66
7.2.330.0060.01116.68
7.2.320.0040.01516.64
7.2.310.0100.00716.87
7.2.300.0000.01816.66
7.2.290.0100.00716.76
7.2.130.0050.00717.06
7.2.120.0080.00617.18
7.2.110.0050.00917.19
7.2.100.0060.00717.12
7.2.90.0050.00916.97
7.2.80.0060.00717.17
7.2.70.0060.00616.98
7.2.60.0100.00417.02
7.2.50.0060.00817.18
7.2.40.0040.00817.06
7.2.30.0070.00517.08
7.2.20.0090.00317.01
7.2.10.0030.01117.18
7.2.00.0080.00617.94
7.1.250.0080.00615.83
7.1.200.0040.01115.86
7.1.100.0150.00618.39
7.1.70.0000.00717.18
7.1.60.0090.01519.82
7.1.50.0120.00917.10
7.1.00.0100.06722.52
7.0.200.0150.00416.91
7.0.140.0000.07722.14
7.0.60.0170.07020.01
7.0.50.0000.08717.88
7.0.40.0100.08020.42
7.0.30.0330.07020.28
7.0.20.0330.06020.17
7.0.10.0200.06720.26
7.0.00.0070.04020.27
5.6.280.0030.07320.90
5.6.210.0130.03320.71
5.6.200.0100.04718.29
5.6.190.0130.07720.33
5.6.180.3230.04020.61
5.6.170.0270.07720.48
5.6.160.0070.04320.59
5.6.150.0100.06018.15
5.6.140.0130.06018.13
5.6.130.0000.08718.23
5.6.120.0030.04721.02
5.6.110.0100.06321.15
5.6.100.0030.09020.96
5.6.90.0230.07021.11
5.6.80.0100.07720.41
5.6.70.0330.07320.39
5.5.350.0070.07320.38
5.5.340.0130.06717.93
5.5.330.0030.07320.13
5.5.320.0170.03720.47
5.5.310.0200.05320.27
5.5.300.0070.08018.08
5.5.290.0200.05318.08
5.5.280.0030.07720.99
5.5.270.0130.07720.65
5.5.260.0130.06720.88
5.5.250.0030.08720.62
5.5.240.0030.05320.33
5.4.450.0200.05319.47
5.4.440.0630.06019.55
5.4.430.0700.06019.43
5.4.420.0100.05319.41
5.4.410.0070.06018.96
5.4.400.0330.05018.84
5.4.390.0570.03718.84
5.4.380.0130.06318.77
5.4.370.0070.05018.65
5.4.360.0130.04018.72
5.4.350.0110.03412.02
5.4.340.0110.04212.02
5.4.320.0030.03912.51
5.4.310.0030.04112.50
5.4.300.0060.03512.50
5.4.290.0060.03712.50
5.4.280.0020.03912.40
5.4.270.0090.03212.37
5.4.260.0050.03912.38
5.4.250.0020.04012.37
5.4.240.0110.03412.38
5.4.230.0050.03912.36
5.4.220.0050.03512.37
5.4.210.0030.03712.37
5.4.200.0080.03612.36
5.4.190.0050.03512.36
5.4.180.0100.03812.36
5.4.170.0020.04012.38
5.4.160.0050.03512.37
5.4.150.0040.03612.37
5.4.140.0060.03612.05
5.4.130.0070.04112.04
5.4.120.0050.04112.00
5.4.110.0060.03412.00
5.4.100.0060.03811.99
5.4.90.0020.04311.99
5.4.80.0090.03412.00
5.4.70.0040.03511.99
5.4.60.0060.03611.98
5.4.50.0050.03611.98
5.4.40.0050.03411.97
5.4.30.0050.03511.97
5.4.20.0050.03511.97
5.4.10.0040.03511.97
5.4.00.0010.03911.46
5.3.290.0080.04412.80
5.3.280.0050.04112.71
5.3.270.0080.03912.72
5.3.260.0090.04912.72
5.3.250.0080.03512.72
5.3.240.0080.03512.72
5.3.230.0070.03512.71
5.3.220.0070.03312.68
5.3.210.0090.03512.68
5.3.200.0050.04012.68
5.3.190.0100.03412.68
5.3.180.0040.03712.68
5.3.170.0060.04012.67
5.3.160.0060.03712.68
5.3.150.0060.03712.67
5.3.140.0050.03612.66
5.3.130.0060.03712.66
5.3.120.0030.04012.66
5.3.110.0060.03812.66
5.3.100.0020.04012.12
5.3.90.0040.03712.09
5.3.80.0040.03812.07
5.3.70.0080.03312.08
5.3.60.0050.03612.07
5.3.50.0060.03412.00
5.3.40.0050.03612.00
5.3.30.0050.03611.97
5.3.20.0050.03811.75
5.3.10.0040.03511.71
5.3.00.0060.03411.70
5.2.170.0020.0329.15
5.2.160.0030.0319.15
5.2.150.0040.0309.15
5.2.140.0020.0329.14
5.2.130.0040.0339.11
5.2.120.0050.0289.11
5.2.110.0060.0279.12
5.2.100.0070.0269.11
5.2.90.0030.0309.11
5.2.80.0020.0329.10
5.2.70.0060.0289.10
5.2.60.0030.0309.05
5.2.50.0050.0289.03
5.2.40.0040.0289.00
5.2.30.0040.0308.98
5.2.20.0040.0298.97
5.2.10.0040.0288.89
5.2.00.0010.0328.75
5.1.60.0040.0238.04
5.1.50.0050.0238.04
5.1.40.0030.0258.02
5.1.30.0040.0268.36
5.1.20.0050.0268.40
5.1.10.0050.0258.12
5.1.00.0050.0248.11
5.0.50.0040.0216.59
5.0.40.0050.0226.45
5.0.30.0030.0326.27
5.0.20.0030.0206.24
5.0.10.0050.0186.21
5.0.00.0030.0316.21
4.4.90.0020.0234.78
4.4.80.0040.0204.75
4.4.70.0040.0154.76
4.4.60.0030.0204.76
4.4.50.0050.0144.77
4.4.40.0030.0244.71
4.4.30.0020.0164.76
4.4.20.0040.0154.84
4.4.10.0060.0224.84
4.4.00.0050.0294.76
4.3.110.0020.0164.67
4.3.100.0020.0194.67
4.3.90.0020.0154.64
4.3.80.0020.0294.58
4.3.70.0010.0174.63
4.3.60.0030.0144.63
4.3.50.0040.0144.63
4.3.40.0020.0244.54
4.3.30.0040.0143.27
4.3.20.0020.0163.25
4.3.10.0030.0153.21
4.3.00.0030.0237.55

preferences:
49.86 ms | 401 KiB | 5 Q