3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = 'aamdkc'; $chars = array(1 => 'a', 2 => 'b', 3 => 'c');// Chars start from a-z $sum = 0; foreach (str_split($data) as $char) { if (($index = array_search($char, $chars)) !== false) { $sum += $index; } } echo $sum;

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.30.0100.00919.30
8.5.20.0080.01019.60
8.5.10.0100.00719.45
8.5.00.0110.01219.86
8.4.180.0040.00719.74
8.4.170.0160.00521.82
8.4.160.0150.00623.92
8.4.150.0060.00616.87
8.4.140.0120.00917.49
8.4.130.0130.00717.62
8.4.120.0120.00920.42
8.4.110.0140.00622.39
8.4.100.0090.00717.86
8.4.90.0070.00217.79
8.4.80.0150.00617.97
8.4.70.0120.00919.45
8.4.60.0120.00917.67
8.4.50.0120.00618.46
8.4.40.0060.01319.24
8.4.30.0040.01320.35
8.4.20.0130.00317.98
8.4.10.0060.00319.58
8.3.300.0120.01018.56
8.3.290.0140.00620.82
8.3.280.0110.01118.56
8.3.270.0120.00716.34
8.3.260.0060.01416.55
8.3.250.0100.00918.85
8.3.240.0130.00816.44
8.3.230.0120.00716.50
8.3.220.0100.00617.20
8.3.210.0100.00816.77
8.3.200.0090.01016.59
8.3.190.0110.00916.98
8.3.180.0090.00717.21
8.3.170.0160.00320.79
8.3.160.0140.00418.24
8.3.150.0080.00017.04
8.3.140.0090.00916.57
8.3.130.0040.00416.55
8.3.120.0150.00418.91
8.3.110.0040.00418.43
8.3.100.0000.00816.60
8.3.90.0100.01026.77
8.3.80.0040.00417.97
8.3.70.0030.01316.50
8.3.60.0110.00718.56
8.3.50.0040.00924.47
8.3.40.0000.01418.84
8.3.30.0100.00718.67
8.3.20.0080.00020.80
8.3.10.0040.00420.22
8.3.00.0000.00720.64
8.2.300.0100.00922.03
8.2.290.0150.00420.55
8.2.280.0120.00716.32
8.2.270.0070.01417.29
8.2.260.0070.00016.29
8.2.250.0060.00918.48
8.2.240.0050.00318.98
8.2.230.0050.00520.94
8.2.220.0080.00037.54
8.2.210.0040.01126.77
8.2.200.0070.00316.50
8.2.190.0110.00716.63
8.2.180.0040.01118.42
8.2.170.0110.00722.96
8.2.160.0100.00722.11
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.77
8.2.110.0090.00022.13
8.2.100.0060.00617.91
8.2.90.0040.00419.40
8.2.80.0000.00917.97
8.2.70.0040.00417.75
8.2.60.0080.00018.05
8.2.50.0040.00418.07
8.2.40.0050.00318.28
8.2.30.0000.00718.13
8.2.20.0040.00418.25
8.2.10.0050.00321.13
8.2.00.0080.00019.25
8.1.340.0110.00817.64
8.1.330.0110.00821.82
8.1.320.0120.00816.34
8.1.310.0040.00416.23
8.1.300.0090.00017.78
8.1.290.0030.00718.88
8.1.280.0040.01125.92
8.1.270.0040.00422.48
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00320.91
8.1.230.0060.00617.89
8.1.220.0000.00917.78
8.1.210.0050.00318.77
8.1.200.0030.00617.38
8.1.190.0030.00517.23
8.1.180.0080.00018.10
8.1.170.0000.00818.37
8.1.160.0080.00018.89
8.1.150.0000.00718.95
8.1.140.0030.00322.05
8.1.130.0030.00320.14
8.1.120.0040.00417.35
8.1.110.0000.00817.47
8.1.100.0090.00017.34
8.1.90.0070.00017.44
8.1.80.0050.00317.45
8.1.70.0030.00317.49
8.1.60.0050.00217.49
8.1.50.0000.01117.53
8.1.40.0050.00317.48
8.1.30.0030.00517.69
8.1.20.0030.00617.67
8.1.10.0000.00717.50
8.1.00.0040.00417.35
8.0.300.0050.00318.77
8.0.290.0030.00616.75
8.0.280.0000.00718.39
8.0.270.0030.00616.81
8.0.260.0000.00719.94
8.0.250.0030.00316.96
8.0.240.0030.00617.01
8.0.230.0000.00616.79
8.0.220.0040.00416.87
8.0.210.0030.00316.87
8.0.200.0000.00616.87
8.0.190.0050.00316.84
8.0.180.0070.00016.88
8.0.170.0030.00516.92
8.0.160.0040.00416.82
8.0.150.0040.00416.79
8.0.140.0030.00316.73
8.0.130.0030.00313.33
8.0.120.0030.00616.81
8.0.110.0000.00816.81
8.0.100.0050.00216.92
8.0.90.0080.00016.78
8.0.80.0060.01016.82
8.0.70.0000.00716.71
8.0.60.0040.00416.75
8.0.50.0030.00516.88
8.0.30.0150.00916.96
8.0.20.0060.01217.21
8.0.10.0000.00816.89
8.0.00.0150.00316.71
7.4.330.0000.00615.55
7.4.320.0030.00316.52
7.4.300.0060.00016.61
7.4.290.0030.00316.50
7.4.280.0030.00616.49
7.4.270.0040.00416.50
7.4.260.0060.00013.17
7.4.250.0030.00316.56
7.4.240.0040.00416.46
7.4.230.0040.00316.50
7.4.220.0040.00316.49
7.4.210.0070.01116.46
7.4.200.0080.00016.41
7.4.130.0060.01216.42
7.4.120.0030.01616.49
7.4.110.0100.00616.48
7.4.100.0100.01316.34
7.4.90.0030.01416.64
7.4.80.0090.00919.39
7.4.70.0080.00816.53
7.4.60.0130.00316.51
7.4.50.0030.00716.55
7.4.40.0100.00716.41
7.4.00.0070.00714.91
7.3.330.0000.00616.17
7.3.320.0000.00613.05
7.3.310.0000.00716.10
7.3.300.0000.00616.36
7.3.290.0000.00616.23
7.3.280.0100.00616.38
7.3.260.0120.00616.53
7.3.230.0130.01216.44
7.3.210.0110.00716.36
7.3.200.0160.00016.63
7.3.190.0090.00616.39
7.3.180.0030.01316.61
7.3.170.0060.00916.34
7.3.160.0110.00416.66
7.3.120.0070.01014.97
7.3.110.0130.00314.76
7.3.100.0080.00814.84
7.3.90.0150.00914.90
7.3.80.0090.00914.75
7.3.70.0110.00314.71
7.3.60.0060.01014.51
7.3.50.0030.01114.88
7.3.40.0030.01214.87
7.3.30.0060.01314.65
7.3.20.0040.01214.93
7.3.10.0030.01114.65
7.3.00.0070.00714.84
7.2.330.0030.01416.35
7.2.320.0170.00716.59
7.2.310.0060.01016.71
7.2.300.0060.01216.36
7.2.290.0050.01216.57
7.2.250.0030.01014.90
7.2.240.0030.01115.15
7.2.230.0120.00914.89
7.2.220.0090.00614.91
7.2.210.0100.00715.13
7.2.200.0000.01514.96
7.2.190.0060.00914.64
7.2.180.0090.00914.91
7.2.170.0090.00615.08
7.1.330.0080.00514.14
7.1.320.0060.00614.04
7.1.310.0050.00814.06
7.1.300.0080.00813.96
7.1.290.0060.00814.11
7.1.280.0110.00713.77
7.1.270.0090.01214.13
7.1.260.0000.01313.83

preferences:
53.6 ms | 1401 KiB | 5 Q