3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replaceString($string) { $array1 = ['mp', 'tm', 'de']; $array2 = ['MAP', 'TM', "DECIMAL"]; $first = substr($string, 0, -2); $last = substr($string, -2); $split = [ 'start' => $first, 'end' => $last, ]; foreach ($array1 as $key => $val) { if ($val == $split['end']) { $word = $split['start'].$array2[$key]; return $word; } } } $mystring = "samplemp"; echo replaceString($mystring)."\n";

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.5.20.0110.00720.17
8.5.10.0140.00416.74
8.5.00.0120.00819.97
8.4.170.0150.00720.45
8.4.160.0120.01122.07
8.4.150.0030.00014.05
8.4.140.0130.01017.53
8.4.130.0150.00317.64
8.4.120.0130.00824.07
8.4.110.0060.00322.64
8.4.100.0030.00618.83
8.4.90.0090.00919.18
8.4.80.0110.00920.46
8.4.70.0100.00918.18
8.4.60.0110.01018.57
8.4.50.0100.01023.74
8.4.40.0000.00919.49
8.4.30.0130.00618.46
8.4.20.0100.01017.65
8.4.10.0060.00319.64
8.3.300.0080.00320.72
8.3.290.0050.00420.75
8.3.280.0090.01218.37
8.3.270.0070.01216.54
8.3.260.0100.01116.62
8.3.250.0030.00519.13
8.3.240.0080.01217.25
8.3.230.0130.00818.77
8.3.220.0090.00518.90
8.3.210.0110.00816.63
8.3.200.0060.00516.78
8.3.190.0050.00417.51
8.3.180.0050.00318.25
8.3.170.0130.00616.66
8.3.160.0030.00716.80
8.3.150.0150.00316.95
8.3.140.0060.00317.25
8.3.130.0100.00618.34
8.3.120.0000.00919.00
8.3.110.0040.00420.94
8.3.100.0120.00324.06
8.3.90.0170.00326.77
8.3.80.0090.00019.36
8.3.70.0040.01116.61
8.3.60.0120.00918.31
8.3.50.0080.01016.42
8.3.40.0070.00718.70
8.3.30.0110.00418.80
8.3.20.0040.00421.77
8.3.10.0070.00023.53
8.3.00.0000.00817.94
8.2.300.0110.01021.91
8.2.290.0130.00520.43
8.2.280.0140.00518.41
8.2.270.0130.00616.77
8.2.260.0090.00618.88
8.2.250.0050.00316.66
8.2.240.0040.00417.37
8.2.230.0060.00322.58
8.2.220.0080.00037.54
8.2.210.0090.00926.77
8.2.200.0030.00618.88
8.2.190.0150.00416.58
8.2.180.0070.01518.18
8.2.170.0090.00622.96
8.2.160.0070.00721.36
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0050.00322.29
8.2.120.0040.00426.35
8.2.110.0040.00720.52
8.2.100.0080.00318.09
8.2.90.0080.00019.34
8.2.80.0000.00817.97
8.2.70.0050.00317.50
8.2.60.0000.00917.93
8.2.50.0030.00618.07
8.2.40.0000.01118.12
8.2.30.0030.00618.00
8.2.20.0000.00818.16
8.2.10.0000.00718.17
8.2.00.0000.00718.19
8.1.340.0110.00817.57
8.1.330.0120.00622.04
8.1.320.0100.00916.22
8.1.310.0150.00416.70
8.1.300.0040.00420.29
8.1.290.0120.00030.84
8.1.280.0120.00625.92
8.1.270.0080.00023.79
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0140.00722.10
8.1.230.0040.00817.89
8.1.220.0030.00617.74
8.1.210.0060.00318.77
8.1.200.0100.00017.35
8.1.190.0080.00017.35
8.1.180.0030.00618.10
8.1.170.0050.00318.56
8.1.160.0040.00418.82
8.1.150.0040.00420.15
8.1.140.0050.00219.61
8.1.130.0030.00317.50
8.1.120.0000.00717.42
8.1.110.0040.00417.41
8.1.100.0040.00417.47
8.1.90.0080.00017.45
8.1.80.0000.00817.50
8.1.70.0000.00717.36
8.1.60.0040.00417.41
8.1.50.0060.00317.52
8.1.40.0030.00517.51
8.1.30.0040.00417.59
8.1.20.0030.00617.59
8.1.10.0000.00717.57
8.1.00.0030.00617.49
8.0.300.0040.00418.77
8.0.290.0060.00316.75
8.0.280.0040.00418.36
8.0.270.0070.00016.77
8.0.260.0070.00016.77
8.0.250.0070.00016.93
8.0.240.0040.00416.95
8.0.230.0090.00016.84
8.0.220.0030.00316.92
8.0.210.0000.00716.91
8.0.200.0000.00716.94
8.0.190.0050.00316.84
8.0.180.0000.00916.80
8.0.170.0000.00716.91
8.0.160.0000.00816.88
8.0.150.0080.00016.74
8.0.140.0080.00016.92
8.0.130.0080.00013.28
8.0.120.0000.00716.90
8.0.110.0090.00016.72
8.0.100.0050.00216.87
8.0.90.0030.00316.74
8.0.80.0130.00316.88
8.0.70.0050.00216.95
8.0.60.0040.00416.96
8.0.50.0050.00216.84
8.0.30.0090.00816.96
8.0.20.0130.00517.42
8.0.10.0070.00016.88
8.0.00.0150.00316.64
7.4.330.0030.00315.55
7.4.320.0040.00416.58
7.4.300.0060.00016.64
7.4.290.0030.00616.41
7.4.280.0000.00816.42
7.4.270.0030.00316.43
7.4.260.0000.00513.25
7.4.250.0030.00316.55
7.4.240.0040.00416.52
7.4.230.0030.00316.63
7.4.220.0090.00916.46
7.4.210.0000.01416.60
7.4.200.0030.00316.60
7.4.160.0070.01116.55
7.4.150.0120.00617.40
7.4.140.0110.01017.86
7.4.130.0070.01616.49
7.4.120.0170.00616.48
7.4.110.0090.00916.45
7.4.100.0100.00716.45
7.4.90.0120.00616.45
7.4.80.0200.00419.39
7.4.70.0030.01316.44
7.4.60.0030.01216.40
7.4.50.0150.00016.49
7.4.40.0060.00916.55
7.4.30.0070.01116.23
7.4.00.0070.00714.57
7.3.330.0000.00613.36
7.3.320.0000.00513.39
7.3.310.0000.00716.37
7.3.300.0000.00716.40
7.3.290.0110.00416.36
7.3.280.0100.00816.34
7.3.270.0170.00017.40
7.3.260.0120.00916.54
7.3.250.0110.01116.48
7.3.240.0080.01216.37
7.3.230.0030.01516.37
7.3.210.0080.00816.55
7.3.200.0070.01516.36
7.3.190.0030.01316.45
7.3.180.0100.00616.35
7.3.170.0120.00316.33
7.3.160.0100.00716.66
7.2.330.0240.00316.77
7.2.320.0090.01216.51
7.2.310.0140.00616.71
7.2.300.0150.00316.56
7.2.290.0090.00916.57
7.2.60.0070.00716.83
7.2.00.0030.01019.18
7.1.200.0090.00015.83
7.1.100.0030.01018.31
7.1.70.0050.00517.33
7.1.60.0060.01517.33
7.1.50.0090.00917.33
7.1.40.0060.00917.33
7.1.30.0100.01017.33
7.1.20.0030.01217.33
7.1.10.0030.00517.33
7.1.00.0030.00517.33
7.0.200.0000.01417.33
7.0.190.0030.00917.33
7.0.180.0000.00917.33
7.0.170.0060.00617.33
7.0.160.0050.00317.33
7.0.150.0050.00317.33
7.0.140.0030.00517.33
7.0.130.0040.00717.33
7.0.120.0070.00317.33
7.0.110.0000.00817.33
7.0.100.0070.00017.33
7.0.90.0070.00317.33
7.0.80.0090.00017.33
7.0.70.0040.00417.33
7.0.60.0050.00517.33
7.0.50.0030.00717.33
7.0.40.0000.01017.33
7.0.30.0000.00817.33
7.0.20.0030.00717.33
7.0.10.0030.00617.33
7.0.00.0030.00717.33

preferences:
155.67 ms | 403 KiB | 5 Q