3v4l.org

run code in 300+ PHP versions simultaneously
<?php # This script will cater for any integer amount between 0 and 999999 $amount = 920915; $tmpAmount = 0; $tmpAmount2 = 0; $divident = 100000; $output = ""; while (($amount > 0) && ($divident > 0)) { if ($amount >= $divident) { $tmpAmount = (int)($amount / $divident); if (strlen($output) > 0) { $output .= "&"; } switch($tmpAmount) { case 1: { $output.="amount/one"; break; } case 2: { $output .= "amount/two"; break; } case 3: { $output .= "amount/three"; break; } case 4: { $output .= "amount/four"; break; } case 5: { $output .= "amount/five"; break; } case 6: { $output .= "amount/six"; break; } case 7: { $output .= "amount/seven"; break; } case 8: { $output .= "amount/eight"; break; } case 9: { $output .= "amount/nine"; break; } } switch($divident) { case 100000: case 100: { $output .= "&amount/hundred"; $output .= "&amount/and"; $tmpAmount2 = substr($amount, 1, 2); if ($tmpAmount2 > 10) { $tmpAmount2 = substr($tmpAmount2, 0, 1) * 10; } switch($tmpAmount2) { case 1: { $output .= "&amount/and"; $output.="&amount/one"; break; } case 2: { $output .= "&amount/and"; $output .= "&amount/two"; break; } case 3: { $output .= "&amount/and"; $output .= "&amount/three"; break; } case 4: { $output .= "&amount/and"; $output .= "&amount/four"; break; } case 5: { $output .= "&amount/and"; $output .= "&amount/five"; break; } case 6: { $output .= "&amount/and"; $output .= "&amount/six"; break; } case 7: { $output .= "&amount/and"; $output .= "&amount/seven"; break; } case 8: { $output .= "&amount/and"; $output .= "&amount/eight"; break; } case 9: { $output .= "&amount/and"; $output .= "&amount/nine"; break; } case 10: { $tmpAmount2 = substr(($amount - ($divident * $tmpAmount)), 0, 2); switch($tmpAmount2) { case 10: { $output.="&amount/ten"; break; } case 11: { $output.="&amount/eleven"; break; } case 12: { $output .= "&amount/twelve"; break; } case 13: { $output .= "&amount/thir"."&amount/teen"; break; } case 14: { $output .= "&amount/four"."&amount/teen"; break; } case 15: { $output .= "&amount/fif"."&amount/teen"; break; } case 16: { $output .= "&amount/six"."&amount/teen"; break; } case 17: { $output .= "&amount/seven"."&amount/teen"; break; } case 18: { $output .= "&amount/eight"."&amount/teen"; break; } case 19: { $output .= "&amount/nine"."&amount/teen"; break; } } if ($divident == 100000) { $output .= "&amount/thousand"; } $amount = (int)substr($amount, 1, strlen($amount)); $divident = ($divident / 10); break; } case 20: { $output .= "&amount/twenty"; break; } case 30: { $output .= "&amount/thirty"; break; } case 40: { $output .= "&amount/fourty"; break; } case 50: { $output .= "&amount/fifty"; break; } case 60: { $output .= "&amount/sixty"; break; } case 70: { $output .= "&amount/seventy"; break; } case 80: { $output .= "&amount/eighty"; break; } case 90: { $output .= "&amount/ninety"; break; } } if ($tmpAmount2 >= 10) { $amount = (int)substr($amount, 1, strlen($amount)); if (($amount>1000) && (($tmpAmount2%10) == 0)) { $divident = ($divident / 100); } else { $divident = ($divident / 10); } } else { $amount = (int)substr($amount, 2, strlen($amount)); $divident = ($divident / 100); } break; } case 1000: { $output .= "&amount/thousand"; break; } } } $amount = (int)substr($amount, 1, strlen($amount)); $divident = ($divident / 10); } echo $output; ?>

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.0090.01216.75
8.3.50.0130.01022.12
8.3.40.0040.01118.68
8.3.30.0080.00819.13
8.3.20.0040.00420.21
8.3.10.0040.00421.90
8.3.00.0040.00422.43
8.2.180.0120.00618.29
8.2.170.0110.00422.96
8.2.160.0150.00022.13
8.2.150.0040.00425.66
8.2.140.0040.00724.66
8.2.130.0080.00026.16
8.2.120.0050.00317.88
8.2.110.0140.00320.87
8.2.100.0040.00818.18
8.2.90.0000.00819.30
8.2.80.0040.00417.97
8.2.70.0030.00517.88
8.2.60.0040.00417.63
8.2.50.0030.00517.63
8.2.40.0000.00819.30
8.2.30.0040.00419.53
8.2.20.0040.00417.85
8.2.10.0080.00018.27
8.2.00.0040.00418.29
8.1.280.0060.00925.92
8.1.270.0100.01022.07
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00622.55
8.1.230.0000.01219.20
8.1.220.0040.00417.91
8.1.210.0050.00318.77
8.1.200.0090.00017.75
8.1.190.0030.00517.35
8.1.180.0050.00318.10
8.1.170.0060.00318.54
8.1.160.0040.00419.12
8.1.150.0040.00418.99
8.1.140.0000.00817.52
8.1.130.0000.00717.71
8.1.120.0040.00417.47
8.1.110.0000.00817.61
8.1.100.0070.00017.53
8.1.90.0000.00717.47
8.1.80.0050.00317.52
8.1.70.0000.00717.59
8.1.60.0000.00917.68
8.1.50.0030.00517.58
8.1.40.0080.00017.57
8.1.30.0050.00317.68
8.1.20.0060.00317.70
8.1.10.0030.00517.48
8.1.00.0000.00817.50
8.0.300.0000.00718.77
8.0.290.0030.00616.88
8.0.280.0070.00018.54
8.0.270.0080.00017.30
8.0.260.0060.00317.39
8.0.250.0080.00017.08
8.0.240.0000.00717.03
8.0.230.0030.00317.07
8.0.220.0070.00016.84
8.0.210.0000.00917.00
8.0.200.0000.00716.88
8.0.190.0050.00316.96
8.0.180.0070.00016.95
8.0.170.0040.00417.04
8.0.160.0050.00216.80
8.0.150.0040.00416.94
8.0.140.0080.00016.88
8.0.130.0030.00313.46
8.0.120.0040.00416.86
8.0.110.0000.00716.95
8.0.100.0070.00016.82
8.0.90.0000.00716.89
8.0.80.0030.01617.04
8.0.70.0000.00716.89
8.0.60.0040.00417.06
8.0.50.0040.00416.87
8.0.30.0110.00917.00
8.0.20.0090.01017.40
8.0.10.0000.00717.00
8.0.00.0140.00916.85
7.4.330.0000.00515.09
7.4.320.0030.00316.63
7.4.300.0060.00016.59
7.4.290.0070.00016.70
7.4.280.0000.00816.50
7.4.270.0000.00716.63
7.4.260.0050.00516.68
7.4.250.0040.00416.62
7.4.240.0040.00416.67
7.4.230.0030.00316.71
7.4.220.0110.01416.60
7.4.210.0130.00316.71
7.4.200.0000.00716.58
7.4.160.0040.01116.37
7.4.150.0110.00517.40
7.4.140.0160.00417.86
7.4.130.0140.00516.62
7.4.120.0110.00816.62
7.4.110.0070.01016.65
7.4.100.0080.01216.59
7.4.90.0100.00716.67
7.4.80.0070.01119.39
7.4.70.0060.01216.40
7.4.60.0120.00316.49
7.4.50.0000.00416.45
7.4.40.0100.01016.44
7.4.30.0070.01116.37
7.4.00.0030.01314.98
7.3.330.0030.00313.17
7.3.320.0050.00013.26
7.3.310.0070.00016.51
7.3.300.0000.00716.41
7.3.290.0120.00516.40
7.3.280.0110.01116.44
7.3.270.0120.00417.40
7.3.260.0070.01016.50
7.3.250.0100.00916.53
7.3.240.0100.00716.42
7.3.230.0090.00916.47
7.3.210.0070.01016.43
7.3.200.0090.00919.39
7.3.190.0120.00616.70
7.3.180.0060.01116.64
7.3.170.0130.01016.56
7.3.160.0060.00916.59
7.3.120.0060.01314.68
7.3.110.0030.01314.80
7.3.100.0030.00915.12
7.3.90.0030.01315.25
7.3.80.0030.00715.05
7.3.70.0080.00014.92
7.3.60.0030.01014.98
7.3.50.0090.00614.99
7.3.40.0070.01014.93
7.3.30.0060.00315.05
7.3.20.0030.00716.64
7.3.10.0090.00316.74
7.3.00.0070.00316.46
7.2.330.0060.01316.76
7.2.320.0070.01016.84
7.2.310.0070.01016.57
7.2.300.0110.00716.57
7.2.290.0060.01616.52
7.2.250.0090.00615.05
7.2.240.0070.01014.86
7.2.230.0030.01014.78
7.2.220.0000.01715.18
7.2.210.0030.00915.06
7.2.200.0000.01414.97
7.2.190.0120.00414.93
7.2.180.0030.00914.98
7.2.170.0070.00314.97
7.2.60.0070.00416.91
7.2.00.0000.01119.45
7.1.330.0030.01015.84
7.1.320.0070.01015.82
7.1.310.0070.00715.88
7.1.300.0030.00615.88
7.1.290.0060.00615.57
7.1.280.0070.00715.86
7.1.270.0080.00615.52
7.1.260.0040.01215.63
7.1.200.0050.00315.95
7.1.100.0030.00718.14
7.1.70.0090.00617.21
7.1.60.0070.01719.59
7.1.50.0040.01916.86
7.1.00.0070.07322.40
7.0.200.0030.00716.86
7.0.60.0100.04019.88
7.0.50.0100.05717.98
7.0.40.0070.06720.19
7.0.30.0530.07720.09
7.0.20.0270.08320.20
7.0.10.0300.05020.00
7.0.00.0070.07319.96
5.6.280.0000.03321.18
5.6.210.0170.07020.65
5.6.200.0070.04718.22
5.6.190.0130.03320.41
5.6.180.4030.04020.39
5.6.170.0300.07720.51
5.6.160.0130.06720.48
5.6.150.0100.03718.13
5.6.140.0030.06018.04
5.6.130.0100.06318.11
5.6.120.0100.08021.16
5.6.110.0200.07321.04
5.6.100.0070.08321.07
5.6.90.0100.05721.00
5.6.80.0130.05720.32
5.6.70.0370.07320.49
5.5.350.0130.08320.47
5.5.340.0100.07717.88
5.5.330.0130.07320.07
5.5.320.0200.04320.21
5.5.310.0330.04720.29
5.5.300.0100.07317.92
5.5.290.0070.04018.02
5.5.280.0070.07020.81
5.5.270.0070.04320.91
5.5.260.0170.07020.68
5.5.250.0030.06320.59
5.5.240.0300.06320.33
5.4.450.0770.05319.61
5.4.440.0870.06019.11
5.4.430.0670.06319.16
5.4.420.0700.05719.66
5.4.410.0600.06719.04
5.4.400.0700.05319.09
5.4.390.0730.05318.82
5.4.380.0800.04719.32
5.4.370.0830.04318.95
5.4.360.0770.05319.18
5.4.350.0770.05019.11
5.4.340.0800.05019.30
5.4.320.0800.05019.18
5.4.310.0730.05018.82
5.4.300.0830.04319.16
5.4.290.0800.04718.82
5.4.280.0730.05318.83
5.4.270.0700.05718.93
5.4.260.0800.05319.18
5.4.250.0730.05318.82
5.4.240.0730.05319.25
5.4.230.0770.06019.03
5.4.220.0700.05719.12
5.4.210.0770.04719.04
5.4.200.0930.03016.76
5.4.190.0700.05318.97
5.4.180.0700.05319.19
5.4.170.0600.05719.16
5.4.160.0600.05019.04
5.4.150.0670.05718.80
5.4.140.0570.05316.25
5.4.130.0600.04716.30
5.4.120.0630.04316.57
5.4.110.0700.03716.60
5.4.100.0600.04716.24
5.4.90.0770.04716.39
5.4.80.0670.05716.57
5.4.70.0830.04716.36
5.4.60.0570.05316.43
5.4.50.0800.04316.54
5.4.40.0570.05316.44
5.4.30.0630.04316.41
5.4.20.0600.05016.53
5.4.10.0570.05016.12
5.4.00.0530.05316.02
5.3.290.0570.05714.61
5.3.280.0570.05314.47
5.3.270.0630.05014.56
5.3.260.0830.05714.57
5.3.250.0870.05314.53
5.3.240.0630.04714.66
5.3.230.0770.05314.48
5.3.220.0530.05714.54
5.3.210.0630.04714.55
5.3.200.0630.04314.53
5.3.190.0670.04314.47
5.3.180.0700.05314.65
5.3.170.0900.03314.50
5.3.160.0600.05014.61
5.3.150.0700.06314.52
5.3.140.0900.04714.43
5.3.130.0770.05014.43
5.3.120.0800.04714.60
5.3.110.0670.04714.46
5.3.100.0830.04313.98
5.3.90.0800.04713.90
5.3.80.0770.04714.07
5.3.70.0830.05013.85
5.3.60.0630.04713.87
5.3.50.1030.07013.86
5.3.40.0800.04313.84
5.3.30.0830.04013.81
5.3.20.0770.04713.59
5.3.10.0770.04713.53
5.3.00.0670.05713.46
5.2.170.0530.05011.04
5.2.160.0700.03311.27
5.2.150.0630.04311.03
5.2.140.0570.04311.07
5.2.130.0600.04011.09
5.2.120.0600.04011.16
5.2.110.0630.03710.94
5.2.100.0630.03711.09
5.2.90.0600.04011.21
5.2.80.0570.04311.14
5.2.70.0530.05011.14
5.2.60.0630.04311.20
5.2.50.0630.03710.93
5.2.40.0470.04010.93
5.2.30.0600.03010.80
5.2.20.0470.04010.86
5.2.10.0530.03710.93
5.2.00.0530.03710.66
5.1.60.0470.03710.20
5.1.50.0400.03010.04
5.1.40.0400.03010.18
5.1.30.0370.03710.29
5.1.20.0370.04010.42
5.1.10.0330.04710.21
5.1.00.0300.04310.25
5.0.50.0200.0278.65
5.0.40.0270.0208.36
5.0.30.0230.0438.42
5.0.20.0230.0308.39
5.0.10.0230.0308.16
5.0.00.0300.0378.20
4.4.90.0200.0235.88
4.4.80.0300.0275.83
4.4.70.0300.0305.82
4.4.60.0200.0235.80
4.4.50.0230.0235.82
4.4.40.0200.0375.93
4.4.30.0270.0375.97
4.4.20.0270.0205.97
4.4.10.0230.0235.95
4.4.00.0300.0276.03
4.3.110.0230.0235.74
4.3.100.0230.0235.86
4.3.90.0200.0235.86
4.3.80.0200.0375.88
4.3.70.0230.0235.83
4.3.60.0230.0205.84
4.3.50.0270.0275.83
4.3.40.0270.0305.68
4.3.30.0100.0235.58
4.3.20.0130.0205.58
4.3.10.0100.0235.58
4.3.00.0100.0277.68

preferences:
60.5 ms | 401 KiB | 5 Q