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 'yes' var_dump($convertQ('Yes')); // expect 'yes', get 'yes' var_dump($convertQ('Unsure')); // expect 'maybe', get 'maybe' var_dump($convertQ('a')); // expect thrown error, get error thrown

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.0110.01117.91
8.4.10.0090.01217.89
8.3.150.0130.00720.65
8.3.140.0060.00316.91
8.3.130.0030.00718.67
8.3.120.0130.00619.00
8.3.110.0150.00020.94
8.3.100.0060.00324.06
8.3.90.0060.00326.77
8.3.80.0060.00316.50
8.3.70.0110.01116.75
8.3.60.0040.01216.49
8.3.50.0100.00921.95
8.3.40.0090.00618.84
8.3.30.0070.00719.21
8.3.20.0080.00020.16
8.3.10.0080.00021.85
8.3.00.0050.00322.34
8.2.260.0030.01418.93
8.2.250.0070.00716.75
8.2.240.0090.00617.06
8.2.230.0000.00822.58
8.2.220.0040.00437.54
8.2.210.0070.00726.77
8.2.200.0090.00016.88
8.2.190.0090.01217.00
8.2.180.0130.00718.29
8.2.170.0120.00319.09
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00720.83
8.2.110.0030.00620.84
8.2.100.0030.01317.84
8.2.90.0070.00018.09
8.2.80.0060.00317.97
8.2.70.0040.00417.93
8.2.60.0030.00817.91
8.2.50.0000.00818.07
8.2.40.0040.00419.31
8.2.30.0030.00718.10
8.2.20.0030.00517.78
8.2.10.0050.00218.10
8.2.00.0040.00417.99
8.1.310.0050.00316.78
8.1.300.0050.00319.97
8.1.290.0030.00618.88
8.1.280.0070.00725.92
8.1.270.0040.00420.29
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0000.00822.18
8.1.230.0060.00620.89
8.1.220.0050.00317.74
8.1.210.0080.00018.93
8.1.200.0050.00517.35
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0000.00818.48
8.1.160.0000.00721.96
8.1.150.0040.00418.84
8.1.140.0000.00817.59
8.1.130.0050.00317.64
8.1.120.0040.00417.55
8.1.110.0050.00217.56
8.1.100.0070.00017.51
8.1.90.0000.00717.31
8.1.80.0000.00717.37
8.1.70.0030.00317.43
8.1.60.0040.00417.67
8.1.50.0050.00317.42
8.1.40.0040.00417.49
8.1.30.0040.00417.56
8.1.20.0020.00517.61
8.1.10.0020.00517.61
8.1.00.0000.00917.39
8.0.300.0040.00419.98
8.0.290.0080.00016.75
8.0.280.0030.00318.48
8.0.270.0030.00316.92
8.0.260.0000.00617.27
8.0.250.0030.00317.00
8.0.240.0030.00517.10
8.0.230.0040.00416.93
8.0.220.0000.00716.96
8.0.210.0030.00316.87
8.0.200.0030.00617.00
8.0.190.0050.00517.07
8.0.180.0000.00716.95
8.0.170.0000.00816.86
8.0.160.0050.00316.82
8.0.150.0040.00416.89
8.0.140.0040.00716.94
8.0.130.0030.00313.43
8.0.120.0030.00616.87
8.0.110.0070.00016.97
8.0.100.0040.00416.77
8.0.90.0050.00316.85
8.0.80.0160.00316.86
8.0.70.0070.00016.85
8.0.60.0080.00016.86
8.0.50.0040.00417.03
8.0.30.0070.01017.16
8.0.20.0060.01317.40
8.0.10.0000.00717.03
8.0.00.0110.01016.90
7.4.330.0000.00515.15
7.4.320.0060.00016.62
7.4.300.0040.00416.67
7.4.290.0070.00016.51
7.4.280.0030.00416.64
7.4.270.0070.00016.63
7.4.260.0000.00716.51
7.4.250.0000.00716.56
7.4.240.0030.00316.53
7.4.230.0040.00416.51
7.4.220.0170.00716.69
7.4.210.0030.01216.64
7.4.200.0030.00316.60
7.4.160.0130.00516.59
7.4.150.0110.00717.40
7.4.140.0130.00917.86
7.4.130.0120.00716.47
7.4.120.0080.01116.67
7.4.110.0080.00816.69
7.4.100.0130.01016.57
7.4.90.0180.00016.46
7.4.80.0100.00819.39
7.4.70.0120.00616.75
7.4.60.0060.00916.72
7.4.50.0060.00316.66
7.4.40.0100.01016.71
7.4.30.0090.01016.68
7.4.10.0100.00716.50
7.4.00.0050.01215.83
7.3.330.0040.00413.45
7.3.320.0030.00313.20
7.3.310.0000.00816.43
7.3.300.0040.00416.36
7.3.290.0080.00716.40
7.3.280.0100.00616.30
7.3.270.0100.00717.40
7.3.260.0110.00516.46
7.3.250.0070.01516.42
7.3.240.0170.00416.43
7.3.230.0100.00716.43
7.3.210.0120.00616.50
7.3.200.0120.00319.39
7.3.190.0060.00916.66
7.3.180.0060.01516.45
7.3.170.0160.00616.52
7.3.160.0090.00616.44
7.3.130.0100.00716.31
7.3.120.0060.01216.48
7.3.110.0030.01316.45
7.3.100.0140.00016.71
7.3.90.0060.00916.27
7.3.80.0030.01016.50
7.3.70.0090.00316.40
7.3.60.0000.01016.46
7.3.50.0120.00316.22
7.3.40.0060.00316.46
7.3.30.0170.00016.26
7.3.20.0110.00318.00
7.3.10.0030.00918.25
7.3.00.0040.01118.29
7.2.330.0030.01416.45
7.2.320.0120.01116.39
7.2.310.0080.00816.67
7.2.300.0090.00916.71
7.2.290.0130.01216.70
7.2.260.0030.01316.57
7.2.250.0030.01616.76
7.2.240.0070.01116.44
7.2.230.0090.00916.23
7.2.220.0000.01216.46
7.2.210.0090.00916.66
7.2.200.0100.00016.40
7.2.190.0070.00716.45
7.2.180.0070.00716.34
7.2.170.0100.00616.48
7.2.160.0070.00716.48
7.2.150.0090.00318.50
7.2.140.0090.00318.36
7.2.130.0030.01718.41
7.2.120.0110.00418.48
7.2.110.0070.00618.38
7.2.100.0090.00618.49
7.2.90.0100.00318.62
7.2.80.0060.00918.48
7.2.70.0100.01018.35
7.2.60.0060.01417.70
7.2.50.0070.01117.60
7.2.40.0100.00718.44
7.2.30.0070.01018.48
7.2.20.0070.00418.26
7.2.10.0030.01018.31
7.2.00.0030.01218.40
7.1.330.0070.01017.01
7.1.320.0080.00317.40
7.1.310.0060.00617.26
7.1.300.0090.00917.23
7.1.290.0100.00617.25
7.1.280.0050.00517.42
7.1.270.0060.01017.27
7.1.260.0090.00317.31
7.1.250.0030.00617.37
7.1.240.0040.00417.29
7.1.230.0070.00717.31
7.1.220.0000.01317.29
7.1.210.0120.00616.88
7.1.200.0060.00816.23
7.1.190.0000.01617.41
7.1.180.0100.00717.24
7.1.170.0030.01217.43
7.1.160.0030.01217.31
7.1.150.0060.00617.45
7.1.140.0140.00017.27
7.1.130.0060.00617.00
7.1.120.0030.01617.18
7.1.110.0100.01017.14
7.1.100.0060.00517.58
7.1.90.0090.00317.45
7.1.80.0140.00017.16
7.1.70.0000.01117.34
7.1.60.0070.01118.40
7.1.50.0080.00916.92
7.1.40.0030.01017.30
7.1.30.0030.00617.12
7.1.20.0070.00617.18
7.1.10.0100.00617.43
7.1.00.0060.03919.85
7.0.330.0090.00616.98
7.0.320.0040.00716.95
7.0.310.0070.01016.88
7.0.300.0040.01516.99
7.0.290.0030.00717.05
7.0.280.0030.01216.84
7.0.270.0090.00316.94
7.0.260.0100.01016.99
7.0.250.0090.00917.05
7.0.240.0060.00617.18
7.0.230.0070.01016.95
7.0.220.0100.00717.04
7.0.210.0100.00717.11
7.0.200.0040.00616.77
7.0.190.0000.01117.03
7.0.180.0030.01017.16
7.0.170.0070.00716.89
7.0.160.0120.00016.80
7.0.150.0060.01017.09
7.0.140.0130.00317.14
7.0.130.0050.00517.13
7.0.120.0070.00717.10
7.0.110.0000.01216.91
7.0.100.0190.04218.48
7.0.90.0040.02918.45
7.0.80.0170.04518.58
7.0.70.0070.03918.53
7.0.60.0250.04218.43
7.0.50.0090.04218.61
7.0.40.0100.04017.58
7.0.30.0030.04517.49
7.0.20.0130.04017.46
7.0.10.0060.02617.48
7.0.00.0020.04617.50
5.6.400.0070.00415.91
5.6.390.0040.00715.89
5.6.380.0070.01115.74
5.6.370.0100.00715.90
5.6.360.0060.01116.04
5.6.350.0090.00315.99
5.6.340.0070.00415.85
5.6.330.0040.01015.68
5.6.320.0030.01015.79
5.6.310.0040.00815.90
5.6.300.0060.00616.10
5.6.290.0090.00615.90
5.6.280.0050.01918.27
5.6.270.0100.00615.97
5.6.260.0030.00716.02
5.6.250.0110.03618.21
5.6.240.0020.03718.26
5.6.230.0030.04118.22
5.6.220.0080.03818.26
5.6.210.0050.04518.21
5.6.200.0100.02518.42
5.6.190.0050.04418.53
5.6.180.0020.04118.42
5.6.170.0030.04918.47
5.6.160.0050.04618.44
5.6.150.0050.04618.52
5.6.140.0070.04518.32
5.6.130.0050.04318.36
5.6.120.0090.04218.39
5.6.110.0100.03018.42
5.6.100.0080.02518.43
5.6.90.0060.02618.40
5.6.80.0080.02318.18
5.6.70.0070.04218.08
5.6.60.0050.02518.09
5.6.50.0110.04117.97
5.6.40.0070.04318.14
5.6.30.0070.04017.96
5.6.20.0100.03218.06
5.6.10.0080.04017.99
5.6.00.0130.03018.09
5.5.380.0050.02418.02
5.5.370.0110.03617.98
5.5.360.0100.03818.08
5.5.350.0050.03817.98
5.5.340.0070.02718.30
5.5.330.0120.03718.45
5.5.320.0080.04118.29
5.5.310.0080.02718.35
5.5.300.0070.04318.27
5.5.290.0060.04218.47
5.5.280.0070.04718.17
5.5.270.0070.05018.22
5.5.260.0050.04618.43
5.5.250.0140.03018.24
5.5.240.0050.03817.91
5.5.230.0050.02717.95
5.5.220.0060.04318.02
5.5.210.0030.04318.01
5.5.200.0100.02217.83
5.5.190.0050.02617.92
5.5.180.0120.03718.01
5.5.170.0000.01015.50
5.5.160.0080.03317.94
5.5.150.0100.03517.84
5.5.140.0050.04417.86
5.5.130.0080.04317.96
5.5.120.0050.04517.98
5.5.110.0020.04018.04
5.5.100.0030.04317.75
5.5.90.0050.04317.90
5.5.80.0070.04417.74
5.5.70.0080.04117.87
5.5.60.0090.04017.77
5.5.50.0080.03717.75
5.5.40.0050.04517.83
5.5.30.0140.03717.82
5.5.20.0100.04217.80
5.5.10.0050.02817.86
5.5.00.0030.05217.70
5.4.450.0070.02015.89
5.4.440.0030.05016.14
5.4.430.0050.04316.02
5.4.420.0050.02616.15
5.4.410.0020.03515.93
5.4.400.0070.02115.83
5.4.390.0040.04215.89
5.4.380.0090.03315.67
5.4.370.0050.04215.71
5.4.360.0070.03315.79
5.4.350.0030.02515.89
5.4.340.0070.04015.82
5.4.330.0100.00012.41
5.4.320.0100.03615.88
5.4.310.0030.04415.86
5.4.300.0030.04315.86
5.4.290.0110.03515.83
5.4.280.0050.03515.92
5.4.270.0050.04315.85
5.4.260.0080.03315.77
5.4.250.0050.03815.86
5.4.240.0080.03815.67
5.4.230.0030.04515.70
5.4.220.0070.04015.83
5.4.210.0050.04115.96
5.4.200.0050.04115.63
5.4.190.0090.03415.70
5.4.180.0030.02815.89
5.4.170.0100.02315.82
5.4.160.0030.04315.62
5.4.150.0130.03415.72
5.4.140.0080.02714.65
5.4.130.0030.04214.48
5.4.120.0070.03914.53
5.4.110.0070.02814.51
5.4.100.0040.02414.42
5.4.90.0070.03814.71
5.4.80.0070.02514.48
5.4.70.0080.03214.49
5.4.60.0100.03214.58
5.4.50.0020.03214.54
5.4.40.0070.03314.65
5.4.30.0070.03514.60
5.4.20.0070.03914.49
5.4.10.0050.03814.61
5.4.00.0090.02414.17
5.3.290.0070.08014.65
5.3.280.0070.05314.61
5.3.270.0100.07014.67
5.3.260.0170.07014.58
5.3.250.0070.06714.75
5.3.240.0030.03714.62
5.3.230.0070.06714.62
5.3.220.0070.07314.60
5.3.210.0070.07314.55
5.3.200.0030.08314.59
5.3.190.0130.06014.70
5.3.180.0070.07314.56
5.3.170.0000.04314.70
5.3.160.0070.07314.69
5.3.150.0030.08014.63
5.3.140.0070.07314.67
5.3.130.0070.08014.61
5.3.120.0030.07714.54
5.3.110.0130.05314.55
5.3.100.0030.07714.16
5.3.90.0130.06314.04
5.3.80.0030.06013.91
5.3.70.0000.08314.06
5.3.60.0100.07014.01
5.3.50.0130.06713.88
5.3.40.0100.06713.96
5.3.30.0030.05713.85
5.3.20.0130.03713.74
5.3.10.0030.07713.77
5.3.00.0070.04713.69
5.2.170.0000.04011.13
5.2.160.0170.03311.14
5.2.150.0070.05710.98
5.2.140.0030.04711.10
5.2.130.0070.05311.17
5.2.120.0070.05311.09
5.2.110.0000.06311.05
5.2.100.0000.04311.12
5.2.90.0030.06010.90
5.2.80.0000.06310.96
5.2.70.0000.03711.09
5.2.60.0030.06310.96
5.2.50.0100.03711.08
5.2.40.0070.06010.81
5.2.30.0070.06311.02
5.2.20.0070.05710.98
5.2.10.0030.03010.88
5.2.00.0030.02710.77
5.1.60.0030.0339.97
5.1.50.0030.0239.99
5.1.40.0070.02010.00
5.1.30.0030.02710.39
5.1.20.0030.02710.41
5.1.10.0030.0279.91
5.1.00.0030.02310.11
5.0.50.0000.0208.95
5.0.40.0000.0238.95
5.0.30.0030.0308.95
5.0.20.0000.0238.95
5.0.10.0000.0208.95
5.0.00.0070.0238.95
4.4.90.0070.0308.95
4.4.80.0030.0338.95
4.4.70.0000.0238.95
4.4.60.0070.0138.95
4.4.50.0000.0238.95
4.4.40.0030.0308.95
4.4.30.0030.0138.95
4.4.20.0030.0178.95
4.4.10.0030.0138.95
4.4.00.0000.0278.95
4.3.110.0070.0108.95
4.3.100.0000.0178.95
4.3.90.0000.0178.95
4.3.80.0000.0238.95
4.3.70.0000.0208.95
4.3.60.0030.0138.95
4.3.50.0030.0108.95
4.3.40.0000.0208.95
4.3.30.0000.0178.95
4.3.20.0000.0178.95
4.3.10.0000.0178.95
4.3.00.0030.0178.95

preferences:
85.92 ms | 403 KiB | 5 Q