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)) { $output .= "&amount/thousand"; $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.0070.01116.75
8.3.50.0110.01022.11
8.3.40.0090.01218.67
8.3.30.0070.00719.13
8.3.20.0080.00020.26
8.3.10.0050.00321.90
8.3.00.0040.00422.57
8.2.180.0090.00625.92
8.2.170.0110.00422.96
8.2.160.0110.00722.14
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00617.72
8.2.110.0060.00321.09
8.2.100.0110.00018.03
8.2.90.0040.00418.40
8.2.80.0000.00818.41
8.2.70.0120.00017.59
8.2.60.0000.00817.75
8.2.50.0050.00317.75
8.2.40.0060.00319.57
8.2.30.0000.00819.42
8.2.20.0030.00617.84
8.2.10.0040.00418.16
8.2.00.0050.00318.15
8.1.280.0040.01125.92
8.1.270.0060.01322.20
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0040.00722.14
8.1.230.0090.00322.73
8.1.220.0060.00317.74
8.1.210.0100.00018.77
8.1.200.0000.00817.48
8.1.190.0040.00417.23
8.1.180.0000.01018.10
8.1.170.0040.00418.92
8.1.160.0040.00419.02
8.1.150.0040.00418.93
8.1.140.0000.00817.56
8.1.130.0050.00217.72
8.1.120.0040.00417.54
8.1.110.0070.00017.52
8.1.100.0000.00717.60
8.1.90.0040.00417.41
8.1.80.0000.00817.40
8.1.70.0050.00217.52
8.1.60.0040.00417.57
8.1.50.0080.00017.58
8.1.40.0000.00817.50
8.1.30.0080.00017.66
8.1.20.0030.00617.73
8.1.10.0030.00517.55
8.1.00.0080.00017.57
8.0.300.0040.00419.93
8.0.290.0050.00216.88
8.0.280.0000.00718.47
8.0.270.0030.00317.36
8.0.260.0050.00517.38
8.0.250.0000.00617.05
8.0.240.0000.00717.06
8.0.230.0070.00017.05
8.0.220.0050.00216.86
8.0.210.0060.00317.07
8.0.200.0030.00317.01
8.0.190.0000.00817.07
8.0.180.0030.00517.03
8.0.170.0000.00717.01
8.0.160.0050.00316.88
8.0.150.0040.00417.02
8.0.140.0020.00516.94
8.0.130.0050.00013.39
8.0.120.0040.00416.98
8.0.110.0040.00416.97
8.0.100.0040.00416.88
8.0.90.0050.00316.98
8.0.80.0070.01016.98
8.0.70.0000.00816.95
8.0.60.0000.00717.04
8.0.50.0040.00416.91
8.0.30.0100.00717.15
8.0.20.0110.01117.40
8.0.10.0000.00817.18
8.0.00.0110.00716.93
7.4.330.0050.00015.09
7.4.320.0030.00316.71
7.4.300.0000.00716.52
7.4.290.0030.00316.70
7.4.280.0040.00416.70
7.4.270.0030.00316.68
7.4.260.0000.01016.59
7.4.250.0000.00816.59
7.4.240.0050.00216.62
7.4.230.0030.00316.68
7.4.220.0060.01316.73
7.4.210.0000.01916.79
7.4.200.0050.00216.49
7.4.160.0060.00916.66
7.4.150.0100.00717.40
7.4.140.0060.01617.86
7.4.130.0100.01216.61
7.4.120.0160.00516.62
7.4.110.0030.01316.61
7.4.100.0030.01816.57
7.4.90.0110.00616.68
7.4.80.0140.00719.39
7.4.70.0190.00016.67
7.4.60.0060.00916.64
7.4.50.0030.00616.61
7.4.40.0030.01416.35
7.4.30.0150.00616.60
7.4.00.0070.00915.15
7.3.330.0000.00513.29
7.3.320.0000.00513.16
7.3.310.0040.00416.39
7.3.300.0040.00416.44
7.3.290.0070.00816.43
7.3.280.0110.01016.43
7.3.270.0130.00417.40
7.3.260.0070.01116.48
7.3.250.0110.01016.47
7.3.240.0130.00316.66
7.3.230.0110.00616.64
7.3.210.0170.00016.35
7.3.200.0060.01019.39
7.3.190.0110.00516.45
7.3.180.0100.00616.39
7.3.170.0100.01116.52
7.3.160.0100.00716.73
7.3.120.0030.01214.95
7.3.110.0120.00614.91
7.3.100.0060.00915.04
7.3.90.0040.01214.97
7.3.80.0080.00414.75
7.3.70.0030.01414.80
7.3.60.0030.00914.78
7.3.50.0040.01114.83
7.3.40.0070.01114.70
7.3.30.0110.00714.85
7.3.20.0110.00316.32
7.3.10.0080.00516.74
7.3.00.0070.00716.83
7.2.330.0070.01016.80
7.2.320.0100.01016.75
7.2.310.0150.01016.62
7.2.300.0130.01316.48
7.2.290.0060.01216.68
7.2.250.0030.01315.04
7.2.240.0100.01015.01
7.2.230.0110.00415.25
7.2.220.0110.00415.19
7.2.210.0030.01015.01
7.2.200.0000.01814.99
7.2.190.0070.00714.91
7.2.180.0030.01214.91
7.2.170.0060.00915.06
7.2.130.0030.01016.81
7.2.120.0320.00916.58
7.2.110.0080.01216.74
7.2.100.0120.00616.57
7.2.90.0110.00716.81
7.2.80.0090.01216.79
7.2.70.0150.00616.85
7.2.60.0120.00716.80
7.2.50.0110.00916.79
7.2.40.0140.00816.86
7.2.30.0130.00816.92
7.2.20.0150.00517.00
7.2.10.0180.00316.78
7.2.00.0120.00517.45
7.1.330.0040.01115.75
7.1.320.0140.00015.92
7.1.310.0000.01115.82
7.1.300.0140.00015.79
7.1.290.0100.00315.77
7.1.280.0070.01116.03
7.1.270.0060.01015.81
7.1.260.0060.00616.02
7.1.250.0040.01115.80
7.1.240.0180.00015.89
7.1.230.0270.00315.74
7.1.220.0280.00015.53
7.1.210.0110.00715.90
7.1.200.0090.00515.74
7.1.190.0130.00715.71
7.1.180.0240.00615.52
7.1.170.0200.01115.73
7.1.160.0140.00315.89
7.1.150.0240.00415.91
7.1.140.0240.01415.80
7.1.130.0120.00315.67
7.1.120.0250.00715.70
7.1.110.0160.00315.73
7.1.100.0130.00916.81
7.1.90.0220.00915.92
7.1.80.0290.00315.88
7.1.70.0180.00416.45
7.1.60.0160.00917.66
7.1.50.0230.00516.33
7.1.40.0280.00315.89
7.1.30.0260.00315.69
7.1.20.0230.00315.86
7.1.10.0210.01015.61
7.1.00.0190.04718.98
7.0.320.0340.00015.41
7.0.310.0280.00715.49
7.0.300.0150.00315.40
7.0.290.0310.00015.47
7.0.280.0070.00715.63
7.0.270.0280.00615.48
7.0.260.0240.00715.41
7.0.250.0310.00015.20
7.0.240.0250.00615.64
7.0.230.0630.00715.40
7.0.220.0150.00315.56
7.0.210.0260.00315.58
7.0.200.0170.00316.13
7.0.190.0380.00915.16
7.0.180.0200.01015.22
7.0.170.0340.00415.56
7.0.160.0420.00615.38
7.0.150.0160.00715.27
7.0.140.0260.00315.36
7.0.130.0120.01615.23
7.0.120.0410.00315.38
7.0.110.0250.00415.50
7.0.100.0100.00515.34
7.0.90.0280.00715.21
7.0.80.0270.00415.50
7.0.70.0290.00315.50
7.0.60.0140.02917.70
7.0.50.0230.03816.53
7.0.40.0080.04016.89
7.0.30.0260.03316.84
7.0.20.0170.02816.83
7.0.10.0180.04716.90
7.0.00.0120.02816.75
5.6.380.0160.00314.21
5.6.370.0040.01314.73
5.6.360.0090.00914.81
5.6.350.0130.00314.40
5.6.340.0160.00014.39
5.6.330.0160.00014.54
5.6.320.0100.01114.54
5.6.310.0180.00014.71
5.6.300.0140.00014.48
5.6.290.0050.01014.67
5.6.280.0070.01917.58
5.6.270.0150.00614.71
5.6.260.0130.00614.77
5.6.250.0150.00314.80
5.6.240.0160.00014.19
5.6.230.0140.00314.37
5.6.220.0080.00814.55
5.6.210.0070.04517.55
5.6.200.0150.04516.29
5.6.190.0120.04617.39
5.6.180.1810.02617.59
5.6.170.0240.02617.57
5.6.160.0090.04417.49
5.6.150.0070.04416.25
5.6.140.0100.03516.37
5.6.130.0070.03216.41
5.6.120.0040.02617.67
5.6.110.0040.04617.65
5.6.100.0120.03617.78
5.6.90.0080.04117.76
5.6.80.0110.03917.38
5.6.70.0170.03917.50
5.6.60.0130.00314.48
5.6.50.0100.00514.42
5.6.40.0000.01414.43
5.6.30.0090.00314.33
5.6.20.0140.00414.13
5.6.10.0080.00814.13
5.6.00.0120.00414.24
5.5.380.0070.01010.91
5.5.370.0090.00611.06
5.5.360.0070.00710.99
5.5.350.0110.04015.94
5.5.340.0050.04214.46
5.5.330.0050.02415.88
5.5.320.0140.03215.61
5.5.310.0230.03215.67
5.5.300.0090.03114.54
5.5.290.0080.03214.62
5.5.280.0100.03716.11
5.5.270.0090.04216.13
5.5.260.0050.04916.00
5.5.250.0120.01815.92
5.5.240.0080.02315.77
5.5.230.0100.00310.94
5.5.220.0110.00311.17
5.5.210.0000.01110.99
5.5.200.0060.00711.21
5.5.190.0050.00511.05
5.5.180.0080.00411.20
5.5.170.0000.01614.32
5.5.160.0090.00311.21
5.5.150.0000.01010.91
5.5.140.0040.01111.26
5.5.130.0070.00411.20
5.5.120.0070.00710.91
5.5.110.0100.00010.93
5.5.100.0100.00311.32
5.5.90.0030.00711.06
5.5.80.0080.00410.97
5.5.70.0160.00011.10
5.5.60.0040.01110.91
5.5.50.0090.00611.20
5.5.40.0120.00310.91
5.5.30.0100.00210.91
5.5.20.0120.00411.00
5.5.10.0060.00610.92
5.5.00.0070.00711.11
5.4.450.0520.02515.15
5.4.440.0540.02715.28
5.4.430.0480.03115.25
5.4.420.0410.02915.30
5.4.410.0460.02915.31
5.4.400.0470.02415.03
5.4.390.0370.03315.03
5.4.380.0450.02515.21
5.4.370.0320.03015.14
5.4.360.0280.03115.17
5.4.350.0330.03115.11
5.4.340.0350.02914.99
5.4.330.0120.00011.00
5.4.320.0460.02315.00
5.4.310.0440.02815.11
5.4.300.0520.04214.93
5.4.290.0480.04215.18
5.4.280.0490.03815.06
5.4.270.0510.02314.97
5.4.260.0470.02315.08
5.4.250.0400.03015.10
5.4.240.0390.02915.28
5.4.230.0460.02314.95
5.4.220.0420.02914.89
5.4.210.0380.03515.23
5.4.200.0390.02813.75
5.4.190.0410.02715.11
5.4.180.0420.02515.06
5.4.170.0390.02915.04
5.4.160.0450.02815.01
5.4.150.0430.03315.04
5.4.140.0550.03213.69
5.4.130.0450.02713.79
5.4.120.0400.02613.67
5.4.110.0460.03013.79
5.4.100.0380.02813.67
5.4.90.0360.02813.62
5.4.80.0390.02413.74
5.4.70.0350.02713.83
5.4.60.0330.02613.63
5.4.50.0340.02613.62
5.4.40.0440.02313.76
5.4.30.0350.02713.73
5.4.20.0380.02813.77
5.4.10.0440.02313.65
5.4.00.0410.02313.44
5.3.290.0430.02812.78
5.3.280.0400.03012.78
5.3.270.0440.02812.73
5.3.260.0450.02512.73
5.3.250.0380.02512.79
5.3.240.0320.02912.75
5.3.230.0360.02512.70
5.3.220.0360.02512.76
5.3.210.0370.02812.71
5.3.200.0340.02512.69
5.3.190.0360.02612.67
5.3.180.0320.03012.71
5.3.170.0370.03212.68
5.3.160.0410.02812.75
5.3.150.0440.02212.71
5.3.140.0450.02312.67
5.3.130.0470.02912.67
5.3.120.0380.03312.70
5.3.110.0420.02712.64
5.3.100.0350.03112.50
5.3.90.0350.03112.44
5.3.80.0390.02512.50
5.3.70.0390.03612.40
5.3.60.0260.02612.40
5.3.50.0060.03112.38
5.3.40.0040.03112.42
5.3.30.0200.02412.35
5.3.20.0340.03012.24
5.3.10.0410.02512.24
5.3.00.0350.02512.23
5.2.170.0320.02711.09
5.2.160.0280.02811.05
5.2.150.0170.02811.06
5.2.140.0040.03110.98
5.2.130.0190.02310.99
5.2.120.0210.02411.08
5.2.110.0030.02510.95
5.2.100.0090.01810.93
5.2.90.0090.02011.04
5.2.80.0260.02511.03
5.2.70.0260.02210.92
5.2.60.0270.02410.93
5.2.50.0300.02310.96
5.2.40.0260.02210.93
5.2.30.0260.01811.01
5.2.20.0190.02410.96
5.2.10.0250.01910.99
5.2.00.0230.02310.81
5.1.60.0220.02110.48
5.1.50.0200.02010.42
5.1.40.0190.02010.40
5.1.30.0290.02110.62
5.1.20.0250.02110.69
5.1.10.0300.02210.59
5.1.00.0250.02310.51
5.0.50.0170.0189.72
5.0.40.0150.0159.64
5.0.30.0150.0229.65
5.0.20.0190.0189.55
5.0.10.0170.0159.57
5.0.00.0160.0249.54
4.4.90.0150.0138.45
4.4.80.0160.0128.44
4.4.70.0120.0148.42
4.4.60.0110.0138.37
4.4.50.0120.0128.37
4.4.40.0070.0228.44
4.4.30.0140.0158.37
4.4.20.0130.0138.43
4.4.10.0100.0148.39
4.4.00.0150.0188.39
4.3.110.0130.0138.34
4.3.100.0020.0148.33
4.3.90.0040.0118.33
4.3.80.0010.0208.37
4.3.70.0170.0148.36
4.3.60.0150.0178.36
4.3.50.0130.0158.36
4.3.40.0130.0178.30
4.3.30.0050.0168.25
4.3.20.0070.0128.25
4.3.10.0040.0158.25
4.3.00.0080.0169.29

preferences:
72.33 ms | 401 KiB | 5 Q