3v4l.org

run code in 300+ PHP versions simultaneously
<?php $convertQ = function ($str) { switch ($str) { case 0: case 'No': return 'no'; case 1: case 'Yes': return 'yes'; case 'Unsure': return 'maybe'; default: throw new \InvalidArgumentException('Unaccounted for value for questionnaire field: ' . $str); } }; var_dump($convertQ(0)); // expect 'no', get 'no' var_dump($convertQ('No')); // expect 'no', get 'no' var_dump($convertQ(1)); // expect 'yes', get 'no' var_dump($convertQ('Yes')); // expect 'yes', get 'no' var_dump($convertQ('Unsure')); // expect 'maybe', get 'no' var_dump($convertQ('a')); // expect thrown error, get 'no'

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.4.20.0160.00417.89
8.4.10.0070.01317.82
8.3.150.0110.00717.10
8.3.140.0110.00716.50
8.3.130.0000.01118.50
8.3.120.0030.00619.09
8.3.110.0050.00320.94
8.3.100.0110.00024.06
8.3.90.0000.00826.77
8.3.80.0090.00017.97
8.3.70.0060.00918.56
8.3.60.0060.01016.63
8.3.50.0130.01122.01
8.3.40.0140.00018.67
8.3.30.0100.00319.04
8.3.20.0000.00720.20
8.3.10.0030.00521.87
8.3.00.0000.00822.52
8.2.260.0140.00316.66
8.2.250.0050.00316.74
8.2.240.0040.00418.84
8.2.230.0030.00622.58
8.2.220.0050.00537.54
8.2.210.0040.00426.77
8.2.200.0080.00318.54
8.2.190.0150.00018.54
8.2.180.0120.00916.72
8.2.170.0070.01322.96
8.2.160.0140.00022.11
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0100.00019.23
8.2.110.0030.00620.35
8.2.100.0090.00319.70
8.2.90.0040.00419.09
8.2.80.0060.00317.97
8.2.70.0040.00417.50
8.2.60.0050.00317.91
8.2.50.0000.00818.07
8.2.40.0080.00019.40
8.2.30.0030.00618.10
8.2.20.0040.00417.83
8.2.10.0030.00618.15
8.2.00.0040.00417.99
8.1.310.0030.00616.61
8.1.300.0130.00618.45
8.1.290.0050.00530.84
8.1.280.0140.00025.92
8.1.270.0000.00923.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00023.73
8.1.230.0110.00018.96
8.1.220.0040.00417.79
8.1.210.0030.00518.77
8.1.200.0030.00617.35
8.1.190.0060.00317.48
8.1.180.0040.00418.10
8.1.170.0000.00918.63
8.1.160.0040.00421.96
8.1.150.0000.00818.93
8.1.140.0000.00717.55
8.1.130.0000.00717.74
8.1.120.0080.00017.52
8.1.110.0000.00817.41
8.1.100.0070.00017.48
8.1.90.0000.00817.35
8.1.80.0030.00317.46
8.1.70.0070.00017.45
8.1.60.0040.00417.50
8.1.50.0040.00417.49
8.1.40.0050.00317.50
8.1.30.0000.00717.52
8.1.20.0030.00617.73
8.1.10.0000.00717.51
8.1.00.0040.00417.50
8.0.300.0060.00318.77
8.0.290.0040.00416.63
8.0.280.0000.00818.44
8.0.270.0000.00817.27
8.0.260.0060.00017.19
8.0.250.0030.00317.11
8.0.240.0050.00217.03
8.0.230.0040.00417.02
8.0.220.0030.00317.01
8.0.210.0040.00416.99
8.0.200.0000.00617.04
8.0.190.0080.00017.00
8.0.180.0070.00017.00
8.0.170.0050.00316.96
8.0.160.0040.00416.76
8.0.150.0030.00516.91
8.0.140.0050.00516.97
8.0.130.0000.00713.44
8.0.120.0030.00616.89
8.0.110.0030.00516.95
8.0.100.0030.00517.01
8.0.90.0050.00216.84
8.0.80.0080.00717.00
8.0.70.0050.00317.04
8.0.60.0040.00416.92
8.0.50.0000.00716.84
8.0.30.0100.01017.17
8.0.20.0110.00817.40
8.0.10.0080.00017.13
8.0.00.0110.01016.81
7.4.330.0000.00515.04
7.4.320.0060.00016.53
7.4.300.0030.00316.61
7.4.290.0030.00316.46
7.4.280.0030.00516.64
7.4.270.0040.00416.45
7.4.260.0000.00716.50
7.4.250.0040.00416.58
7.4.240.0030.00316.60
7.4.230.0070.00016.61
7.4.220.0120.00616.55
7.4.210.0090.00616.69
7.4.200.0040.00416.64
7.4.160.0110.00316.48
7.4.150.0170.00017.40
7.4.140.0150.00917.86
7.4.130.0090.00816.52
7.4.120.0060.01116.43
7.4.110.0080.00816.58
7.4.100.0090.00916.29
7.4.90.0130.00416.42
7.4.80.0120.00819.39
7.4.70.0100.00716.48
7.4.60.0080.00816.44
7.4.50.0000.00816.49
7.4.40.0070.01516.75
7.4.30.0130.00616.58
7.4.00.0100.00714.88
7.3.330.0000.00513.31
7.3.320.0050.00013.27
7.3.310.0000.00716.34
7.3.300.0030.00316.18
7.3.290.0070.00916.27
7.3.280.0120.01016.26
7.3.270.0110.00617.40
7.3.260.0130.00616.35
7.3.250.0090.01216.47
7.3.240.0100.00716.32
7.3.230.0040.02016.39
7.3.210.0100.00616.40
7.3.200.0070.01519.39
7.3.190.0090.00716.50
7.3.180.0100.01016.59
7.3.170.0060.01316.33
7.3.160.0070.01016.70
7.3.120.0100.00714.76
7.3.110.0080.00414.64
7.3.100.0100.00314.39
7.3.90.0040.01114.49
7.3.80.0100.00314.70
7.3.70.0060.00614.48
7.3.60.0090.00614.92
7.3.50.0040.01214.83
7.3.40.0040.01214.83
7.3.30.0030.01014.58
7.3.20.0030.00916.63
7.3.10.0050.01116.55
7.3.00.0080.01016.49
7.2.330.0100.00716.55
7.2.320.0090.01316.46
7.2.310.0030.01416.29
7.2.300.0100.00616.55
7.2.290.0060.01316.70
7.2.240.0030.01214.89
7.2.230.0070.00715.14
7.2.220.0000.01515.02
7.2.210.0100.00614.84
7.2.200.0130.00314.88
7.2.190.0000.01814.69
7.2.180.0000.01814.93
7.2.170.0090.00314.75
7.2.160.0170.00015.16
7.2.150.0060.00616.77
7.2.140.0070.01117.02
7.2.130.0150.00416.78
7.2.120.0100.00516.61
7.2.110.0100.00816.64
7.2.100.0090.00916.76
7.2.90.0070.01016.65
7.2.80.0080.00916.54
7.2.70.0140.00816.62
7.2.60.0190.00716.56
7.2.50.0280.00916.81
7.2.40.0080.01116.62
7.2.30.0070.01016.69
7.2.20.0130.00916.62
7.2.10.0130.00616.63
7.2.00.0060.00917.62
7.1.330.0100.00715.57
7.1.320.0070.01015.86
7.1.310.0050.00315.72
7.1.300.0000.01215.50
7.1.290.0050.00515.60
7.1.280.0140.00315.45
7.1.270.0000.01115.63
7.1.260.0040.00815.62
7.1.250.0130.00515.47
7.1.100.0130.00718.02
7.1.70.0040.00717.06
7.1.60.0140.01119.59
7.1.50.0070.01416.96
7.1.00.0070.07322.43
7.0.200.0000.00816.71
7.0.60.0230.07719.92
7.0.50.0030.05017.87
7.0.40.0070.05720.02
7.0.30.0200.04020.12
7.0.20.0270.06720.16
7.0.10.0230.04720.23
7.0.00.0100.07320.09
5.6.280.0000.05321.12
5.6.210.0070.07720.50
5.6.200.0070.04018.12
5.6.190.0000.05320.57
5.6.180.2200.04320.52
5.6.170.0230.05320.62
5.6.160.0100.04020.71
5.6.150.0030.04718.24
5.6.140.0030.04018.14
5.6.130.0030.08318.15
5.6.120.0070.04720.99
5.6.110.0200.06320.98
5.6.100.0030.05021.01
5.6.90.0130.07720.97
5.6.80.0100.06020.51
5.6.70.0230.03720.39
5.5.350.0230.06320.41
5.5.340.0070.03718.02
5.5.330.0030.04020.37
5.5.320.0400.07720.35
5.5.310.0170.04020.36
5.5.300.0030.07017.99
5.5.290.0000.07717.98
5.5.280.0070.08720.66
5.5.270.0070.04720.96
5.5.260.0070.04020.74
5.5.250.0030.04020.55
5.5.240.0230.04020.13
5.4.450.0770.06019.57
5.4.440.0800.05019.55
5.4.430.0670.04719.52
5.4.420.0670.04719.41
5.4.410.0570.05719.20
5.4.400.0530.05718.84
5.4.390.0700.06019.09
5.4.380.0730.04718.93
5.4.370.0830.06018.98
5.4.360.0970.06319.00
5.4.350.0800.06719.14
5.4.340.0730.06019.13
5.4.320.0730.05019.23
5.4.310.0730.05719.13
5.4.300.0730.06318.94
5.4.290.0670.04719.19
5.4.280.0730.05019.12
5.4.270.0570.05718.94
5.4.260.0600.05019.09
5.4.250.0570.06019.23
5.4.240.0800.05018.99
5.4.230.0730.05319.08
5.4.220.0470.06018.86
5.4.210.0030.06019.01
5.4.200.0100.05016.97
5.4.190.0170.04318.99
5.4.180.0800.06719.10
5.4.170.0800.06019.12
5.4.160.0670.05719.16
5.4.150.0900.06718.98
5.4.140.0700.05016.26
5.4.130.0830.05316.67
5.4.120.0830.04716.67
5.4.110.0770.04716.41
5.4.100.0700.05316.66
5.4.90.1100.05016.46
5.4.80.0700.04716.42
5.4.70.0600.05716.25
5.4.60.0670.05016.46
5.4.50.0670.04716.38
5.4.40.0700.06016.53
5.4.30.0600.05316.31
5.4.20.0770.04316.24
5.4.10.0630.05316.21
5.4.00.0770.04015.73
5.3.290.0630.05714.71
5.3.280.0670.05714.51
5.3.270.0730.05014.60
5.3.260.0700.05014.59
5.3.250.0670.05314.72
5.3.240.0600.06014.60
5.3.230.0670.05314.81
5.3.220.0700.05014.55
5.3.210.0700.05314.53
5.3.200.0770.04714.64
5.3.190.0770.04714.64
5.3.180.0700.05014.64
5.3.170.0830.03714.48
5.3.160.0670.05014.71
5.3.150.0600.06014.53
5.3.140.0670.05314.73
5.3.130.0700.04714.62
5.3.120.0670.04714.57
5.3.110.0730.03714.52
5.3.100.0600.04714.08
5.3.90.0670.04714.23
5.3.80.0730.04713.99
5.3.70.0500.05714.23
5.3.60.0670.05014.21
5.3.50.0700.04714.02
5.3.40.0700.04713.91
5.3.30.0730.04314.12
5.3.20.0730.04313.66
5.3.10.0570.05313.88
5.3.00.0430.06013.66
5.2.170.0700.04311.06
5.2.160.0500.04311.06
5.2.150.0470.05011.00
5.2.140.0670.03310.97
5.2.130.0500.04311.20
5.2.120.0500.04311.11
5.2.110.0570.04010.99
5.2.100.0470.04310.95
5.2.90.0530.03311.20
5.2.80.0470.04011.01
5.2.70.0430.04311.09
5.2.60.0530.03710.88
5.2.50.0600.04010.88
5.2.40.0430.04310.84
5.2.30.0430.04711.01
5.2.20.0430.04010.96
5.2.10.0470.03710.71
5.2.00.0530.03310.70
5.1.60.0500.0309.97
5.1.50.0400.0379.91
5.1.40.0430.0339.97
5.1.30.0430.03310.28
5.1.20.0430.03710.20
5.1.10.0400.03310.10
5.1.00.0400.03310.14
5.0.50.0200.0278.63
5.0.40.0300.0208.32
5.0.30.0230.0438.26
5.0.20.0230.0278.19
5.0.10.0200.0308.26
5.0.00.0200.0438.30
4.4.90.0200.0205.78
4.4.80.0170.0235.77
4.4.70.0270.0175.75
4.4.60.0200.0205.75
4.4.50.0000.0235.85
4.4.40.0000.0375.76
4.4.30.0100.0135.82
4.4.20.0000.0235.92
4.4.10.0070.0175.88
4.4.00.0030.0335.79
4.3.110.0070.0175.79
4.3.100.0070.0205.82
4.3.90.0030.0205.83
4.3.80.0000.0375.80
4.3.70.0100.0235.67
4.3.60.0230.0235.74
4.3.50.0230.0205.73
4.3.40.0170.0375.70
4.3.30.0070.0234.60
4.3.20.0100.0204.58
4.3.10.0070.0274.45
4.3.00.0230.0137.14

preferences:
85.59 ms | 403 KiB | 5 Q