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.3.60.0120.00918.31
8.3.50.0070.00716.25
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.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.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:
35.04 ms | 400 KiB | 5 Q