3v4l.org

run code in 300+ PHP versions simultaneously
<?php function v1($value) { return implode(array_map(function($value) { return ucfirst($value); }, explode('_', $value))); } function v2($value) { return preg_replace_callback('/([A-Z])/', function($char) { return '_'.strtolower($char[1]); }, lcfirst($value)); } function v3($value){ return preg_replace('/_(.?)/e',"strtoupper('$1')",$value); } for($x = 0; $x < 10000; $x++){ $foo = v3('foo_bar_baz_bee'); if($x = 0) echo $foo; }

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.70.0100.00716.58
8.3.60.0070.01018.18
8.3.50.0100.00521.02
8.3.40.0140.00418.41
8.3.30.0090.00619.15
8.3.20.0080.00020.16
8.3.10.0080.00022.14
8.3.00.0070.00022.40
8.2.180.0110.00418.26
8.2.170.0070.01422.96
8.2.160.0070.00720.77
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0070.00319.54
8.2.110.0030.00622.16
8.2.100.0070.00419.41
8.2.90.0050.00219.09
8.2.80.0000.00719.38
8.2.70.0080.00017.36
8.2.60.0040.00417.68
8.2.50.0000.00818.07
8.2.40.0000.00718.09
8.2.30.0000.00718.07
8.2.20.0000.00717.64
8.2.10.0070.00017.69
8.2.00.0000.00717.68
8.1.280.0080.00625.92
8.1.270.0080.00018.45
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0060.00323.84
8.1.230.0040.00819.08
8.1.220.0000.00717.74
8.1.210.0000.00718.77
8.1.200.0090.00017.22
8.1.190.0040.00417.50
8.1.180.0000.00718.65
8.1.170.0030.00618.50
8.1.160.0040.00422.16
8.1.150.0000.00718.64
8.1.140.0000.00717.50
8.1.130.0060.00317.92
8.1.120.0030.00517.35
8.1.110.0040.00417.40
8.1.100.0000.00817.35
8.1.90.0030.00317.45
8.1.80.0040.00417.47
8.1.70.0000.00717.43
8.1.60.0030.00517.69
8.1.50.0040.00417.47
8.1.40.0040.00417.50
8.1.30.0000.00717.57
8.1.20.0000.00917.70
8.1.10.0070.00017.48
8.1.00.0040.00417.46
8.0.300.0030.00318.77
8.0.290.0000.00816.80
8.0.280.0000.00718.31
8.0.270.0040.00417.20
8.0.260.0060.00316.78
8.0.250.0070.00016.90
8.0.240.0040.00416.89
8.0.230.0040.00416.93
8.0.220.0030.00316.78
8.0.210.0040.00416.77
8.0.200.0040.00416.81
8.0.190.0070.00016.88
8.0.180.0030.00616.79
8.0.170.0040.00416.82
8.0.160.0000.00816.68
8.0.150.0000.00816.77
8.0.140.0000.00716.68
8.0.130.0030.00313.28
8.0.120.0000.00716.75
8.0.110.0080.00016.65
8.0.100.0000.00816.63
8.0.90.0000.00716.70
8.0.80.0130.00316.71
8.0.70.0000.00816.83
8.0.60.0030.00516.80
8.0.50.0050.00216.60
8.0.30.0120.00816.85
8.0.20.0140.00717.40
8.0.10.0040.00416.99
8.0.00.0110.00816.71
7.4.330.0050.00015.00
7.4.320.0000.00716.18
7.4.300.0030.00316.46
7.4.290.0090.00016.47
7.4.280.0000.00716.25
7.4.270.0000.00716.30
7.4.260.0030.00316.46
7.4.250.0000.00716.34
7.4.240.0000.00716.39
7.4.230.0030.00316.40
7.4.220.0000.01516.48
7.4.210.0070.00916.50
7.4.200.0000.00716.50
7.4.190.0040.00416.27
7.4.160.0110.00816.51
7.4.150.0130.00717.40
7.4.140.0120.00917.86
7.4.130.0130.00616.53
7.4.120.0170.00316.51
7.4.110.0080.01216.31
7.4.100.0150.00416.35
7.4.90.0110.01116.52
7.4.80.0080.01619.39
7.4.70.0060.01116.38
7.4.60.0140.00316.38
7.4.50.0000.00416.40
7.4.40.0030.01022.77
7.4.30.0120.00916.29
7.4.00.0040.01115.15
7.3.330.0000.00613.40
7.3.320.0000.00713.41
7.3.310.0000.00716.23
7.3.300.0070.00016.16
7.3.290.0130.00716.28
7.3.280.0080.01116.21
7.3.270.0060.01217.40
7.3.260.0090.01316.20
7.3.250.0150.00816.25
7.3.240.0130.00916.34
7.3.230.0040.01516.43
7.3.210.0190.00916.43
7.3.200.0120.01219.39
7.3.190.0120.00816.34
7.3.180.0110.01316.23
7.3.170.0000.01716.45
7.3.160.0110.00716.36
7.3.120.0090.00615.02
7.2.330.0110.00716.60
7.2.320.0110.01716.67
7.2.310.0210.03416.64
7.2.300.0110.00816.68
7.2.290.0080.01116.76
7.2.60.0110.00316.86
7.2.00.0070.00719.55
7.1.200.0110.00415.94
7.1.100.0040.01218.26
7.1.70.0000.00716.96
7.1.60.0100.00719.82
7.1.50.0070.01617.27
7.1.00.0000.08022.46
7.0.200.0030.00716.97
7.0.140.0000.07722.17
7.0.60.0030.04019.93
7.0.50.0030.09017.83
7.0.40.0130.06319.93
7.0.30.0170.04019.96
7.0.20.0300.08019.89
7.0.10.0100.07719.77
7.0.00.0030.04319.98
5.6.280.0100.07321.30
5.6.210.0030.09020.75
5.6.200.0070.08718.43
5.6.190.0030.09320.59
5.6.180.0200.07020.73
5.6.170.0230.03720.60
5.6.160.0170.06720.68
5.6.150.0070.05718.40
5.6.140.0030.08018.43
5.6.130.0030.06318.41
5.6.120.0030.05021.24
5.6.110.0070.07021.28
5.6.100.0170.07321.39
5.6.90.0000.09321.31
5.6.80.0100.03320.68
5.5.350.0070.08320.62
5.5.340.0030.07018.31
5.5.330.0100.05320.44
5.5.320.2430.04720.46
5.5.310.0300.04020.41
5.5.300.0030.08718.24
5.5.290.0100.08718.27
5.5.280.0000.04720.96
5.5.270.0100.05320.95
5.5.260.0000.09721.24
5.5.250.0170.08020.90
5.5.240.0070.06720.43
5.4.450.0472.33019.67
5.4.440.0332.33019.46
5.4.430.0302.43019.50
5.4.420.0332.35719.71
5.4.410.0302.43719.38
5.4.400.0202.45719.39
5.4.390.0502.40319.35
5.4.380.0202.44019.19
5.4.370.0172.43019.33
5.4.360.0232.43719.35
5.4.350.0102.43019.47
5.4.340.0272.42719.20
5.4.320.0202.39019.34
5.4.310.0272.41019.17
5.4.300.0332.44019.38
5.4.290.0172.36719.17
5.4.280.0302.29719.13
5.4.270.0202.25719.19
5.4.260.0472.35319.33
5.4.250.0332.33319.34
5.4.240.0272.42319.37
5.4.230.0232.39719.23
5.4.220.0532.38319.33
5.4.210.0332.40019.33
5.4.200.0272.31319.13
5.4.190.0232.39019.11
5.4.180.0272.42319.45
5.4.170.0202.39719.38
5.4.160.0232.37019.12
5.4.150.0232.31719.33
5.4.140.0532.01016.64
5.4.130.0371.44316.76
5.4.120.0372.38716.79
5.4.110.0472.39016.76
5.4.100.0602.26016.54
5.4.90.0272.42316.71
5.4.80.0232.42016.81
5.4.70.0302.37716.56
5.4.60.0432.31016.74
5.4.50.0172.37316.73
5.4.40.0232.36016.55
5.4.30.0372.24716.58
5.4.20.0272.37716.80
5.4.10.0432.35716.52
5.4.00.0372.37016.29
5.3.290.0272.41714.86
5.3.280.0202.41014.65
5.3.270.0402.34714.81
5.3.260.0572.33314.71
5.3.250.0502.23714.68
5.3.240.0202.19314.87
5.3.230.0332.39014.87
5.3.220.0372.37314.88
5.3.210.0102.41014.85
5.3.200.0102.39714.79
5.3.190.0432.38314.84
5.3.180.0432.38714.79
5.3.170.0302.40014.76
5.3.160.0632.41014.75
5.3.150.0172.37314.73
5.3.140.0532.31014.73
5.3.130.0172.41714.78
5.3.120.0502.29014.74
5.3.110.0172.43014.74
5.3.100.0132.40014.31
5.3.90.0472.31314.14
5.3.80.0172.34014.22
5.3.70.0172.40314.23
5.3.60.0272.37714.13
5.3.50.0302.18714.21
5.3.40.0171.85714.16
5.3.30.0571.10014.00
5.3.20.0371.89713.90
5.3.10.0272.41013.72
5.3.00.0272.43313.76
5.2.170.0170.0309.22
5.2.160.0130.0359.21
5.2.150.0380.0729.21
5.2.140.0110.0379.21
5.2.130.0310.0759.18
5.2.120.0140.0339.17
5.2.110.0120.0369.18
5.2.100.0330.0769.18
5.2.90.0210.0279.16
5.2.80.0110.0399.15
5.2.70.0300.0799.15
5.2.60.0140.0329.11
5.2.50.0110.0389.08
5.2.40.0110.0369.06
5.2.30.0120.0369.03
5.2.20.0120.0349.04
5.2.10.0110.0358.94
5.2.00.0280.1418.79
5.1.60.0160.0248.08
5.1.50.0130.0288.07
5.1.40.0120.0288.06
5.1.30.0130.0308.40
5.1.20.0190.0558.45
5.1.10.0070.0368.16
5.1.00.0460.0568.15
5.0.50.0090.0256.63
5.0.40.0110.0236.49
5.0.30.0240.0826.32
5.0.20.0350.1186.27
5.0.10.0090.0236.25
5.0.00.0110.0356.24
4.4.90.0120.0154.78
4.4.80.0080.0174.75
4.4.70.0170.0684.76
4.4.60.0070.0194.76
4.4.50.0090.0164.77
4.4.40.0070.0284.71
4.4.30.0110.0254.76
4.4.20.0090.0184.84
4.4.10.0070.0184.85
4.4.00.0100.0274.76
4.3.110.0070.0184.67
4.3.100.0080.0174.66
4.3.90.0070.0174.64
4.3.80.0090.0274.58
4.3.70.0070.0184.63
4.3.60.0340.0534.63
4.3.50.0060.0194.63
4.3.40.0080.0294.54
4.3.30.0170.0683.52
4.3.20.0050.0193.52
4.3.10.0300.0153.52
4.3.00.0100.01714.52

preferences:
60.78 ms | 401 KiB | 5 Q