3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getPatientCodeDisplay($id='') { $retstr = ""; if(intval($id)>0) { $max_id_length = 6; $id_length = strlen($id); if($id_length <= $max_id_length) { $prefix_code = "AHD"; $final_len = $max_id_length+strlen($prefix_code)-$id_length; $retstr = str_pad($prefix_code, $final_len, "0", STR_PAD_RIGHT); $retstr .= $id; } } return $retstr; } echo getPatientCodeDisplay(1)." >> "; echo getPatientCodeDisplay(12)." >> "; echo getPatientCodeDisplay(123)." >> "; echo getPatientCodeDisplay(1234)." >> "; echo getPatientCodeDisplay(12345)." >> "; echo getPatientCodeDisplay(123456)." >> "; echo getPatientCodeDisplay(1234567)." >> ";

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.01016.75
8.3.50.0180.00416.50
8.3.40.0040.01118.63
8.3.30.0040.01118.79
8.3.20.0030.00618.73
8.3.10.0040.00420.52
8.3.00.0030.00519.26
8.2.180.0110.01118.41
8.2.170.0040.01122.96
8.2.160.0070.01021.12
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0000.00726.16
8.2.120.0080.00019.51
8.2.110.0070.01022.24
8.2.100.0090.00317.97
8.2.90.0050.00317.88
8.2.80.0000.00818.61
8.2.70.0050.00317.63
8.2.60.0060.00317.93
8.2.50.0000.00818.07
8.2.40.0070.00018.16
8.2.30.0070.00018.16
8.2.20.0100.00017.82
8.2.10.0040.00417.68
8.2.00.0060.00317.66
8.1.280.0110.00425.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00720.53
8.1.230.0080.00417.70
8.1.220.0050.00317.88
8.1.210.0000.00818.77
8.1.200.0060.00317.22
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0000.00818.61
8.1.160.0000.00818.86
8.1.150.0000.00718.91
8.1.140.0040.00417.36
8.1.130.0070.00017.84
8.1.120.0040.00417.55
8.1.110.0080.00017.50
8.1.100.0040.00417.38
8.1.90.0040.00417.50
8.1.80.0030.00317.43
8.1.70.0030.00317.45
8.1.60.0060.00317.48
8.1.50.0040.00417.43
8.1.40.0030.00517.43
8.1.30.0060.00317.70
8.1.20.0050.00317.57
8.1.10.0000.00817.39
8.1.00.0000.00817.35
8.0.300.0050.00318.77
8.0.290.0040.00416.75
8.0.280.0000.00718.45
8.0.270.0030.00317.32
8.0.260.0030.00316.87
8.0.250.0040.00416.98
8.0.240.0040.00416.94
8.0.230.0040.00416.84
8.0.220.0080.00016.92
8.0.210.0000.00716.84
8.0.200.0030.00317.01
8.0.190.0040.00417.02
8.0.180.0000.00716.87
8.0.170.0080.00016.89
8.0.160.0030.00616.80
8.0.150.0050.00316.84
8.0.140.0040.00316.76
8.0.130.0000.00513.30
8.0.120.0030.00516.84
8.0.110.0000.00816.90
8.0.100.0030.00316.88
8.0.90.0000.00716.89
8.0.80.0120.00416.93
8.0.70.0000.00816.88
8.0.60.0030.00516.77
8.0.50.0000.00716.72
8.0.30.0150.00317.16
8.0.20.0150.00417.24
8.0.10.0080.00016.92
8.0.00.0100.01016.82
7.4.330.0030.00312.99
7.4.320.0000.00716.48
7.4.300.0000.00716.63
7.4.290.0030.00316.54
7.4.280.0000.00716.54
7.4.270.0030.00316.63
7.4.260.0020.00313.23
7.4.250.0030.00616.61
7.4.240.0020.00516.52
7.4.230.0030.00316.60
7.4.220.0070.01116.64
7.4.210.0070.00816.51
7.4.200.0040.00416.67
7.4.190.0000.00716.54
7.4.160.0120.00916.32
7.4.150.0110.00716.64
7.4.140.0110.00716.59
7.4.130.0090.00816.49
7.4.120.0140.00316.70
7.4.110.0120.00616.32
7.4.100.0030.01416.54
7.4.90.0130.01016.57
7.4.80.0070.01019.39
7.4.70.0040.01316.52
7.4.60.0070.01016.54
7.4.50.0000.01316.39
7.4.40.0100.00316.55
7.4.30.0130.00316.59
7.4.00.0030.00714.83
7.3.330.0000.00613.39
7.3.320.0030.00313.21
7.3.310.0000.00716.43
7.3.300.0070.00016.25
7.3.290.0100.00716.43
7.3.280.0060.01116.38
7.3.270.0090.00816.27
7.3.260.0120.00416.51
7.3.250.0080.01216.37
7.3.240.0130.00316.53
7.3.230.0040.01216.65
7.3.210.0090.00916.38
7.3.200.0120.00616.38
7.3.190.0040.01516.48
7.3.180.0070.01016.71
7.3.170.0070.01016.46
7.3.160.0120.00416.49
7.3.120.0070.00715.05
7.2.330.0090.00916.48
7.2.320.0160.00616.72
7.2.310.0040.01516.38
7.2.300.0100.00716.73
7.2.290.0150.00716.68
7.2.00.0100.00319.52
7.1.200.0080.00315.66
7.1.100.0000.01517.88
7.1.70.0000.01017.19
7.1.60.0130.01319.40
7.1.50.0060.01616.95
7.1.00.0000.07022.51
7.0.200.0040.00416.43
7.0.140.0000.07722.00
7.0.120.0070.07021.96
7.0.60.0070.04019.95
7.0.50.0070.06317.89
7.0.40.0200.07320.40
7.0.30.0330.07320.35
7.0.20.0230.08020.09
7.0.10.0330.07720.05
7.0.00.0130.07720.23
5.6.280.0030.07320.97
5.6.210.0070.08020.63
5.6.200.0170.07318.13
5.6.190.0130.08020.61
5.6.180.0270.08020.58
5.6.170.0330.07320.47
5.6.160.0000.05720.54
5.6.150.0200.07018.16
5.6.140.0070.07318.14
5.6.130.0030.07718.15
5.6.120.0100.08721.05
5.6.110.0100.04320.99
5.6.100.0100.06021.00
5.6.90.0100.08021.11
5.6.80.0100.08020.36
5.6.70.0270.06320.47
5.5.350.0300.06020.45
5.5.340.0100.05718.09
5.5.330.0030.09320.31
5.5.320.0230.08020.40
5.5.310.0330.06720.25
5.5.300.0100.05017.96
5.5.290.0030.05318.09
5.5.280.0000.05720.76
5.5.270.0030.06020.89
5.5.260.0230.07020.84
5.5.250.0000.04320.69
5.5.240.0030.05720.15
5.4.450.0470.06719.55
5.4.440.0430.04319.20
5.4.430.0530.06319.46
5.4.420.0430.07019.56
5.4.410.0470.06319.34
5.4.400.0500.06319.00
5.4.390.0470.05019.07
5.4.380.0400.05719.08
5.4.370.0530.06319.15
5.4.360.0500.06319.21
5.4.350.0400.04319.15
5.4.340.0470.04019.15
5.4.320.0570.06719.09
5.4.310.0570.06319.00
5.4.300.0470.06719.31
5.4.290.0470.06319.19
5.4.280.0430.06019.03
5.4.270.0670.05019.16
5.4.260.0470.06719.12
5.4.250.0530.06019.08
5.4.240.0500.04319.21
5.4.230.0600.06019.07
5.4.220.0500.05319.19
5.4.210.0530.05719.11
5.4.200.0530.06319.12
5.4.190.0430.04019.22
5.4.180.0400.04719.15
5.4.170.0570.06319.07
5.4.160.0470.05719.11
5.4.150.0570.05319.05
5.4.140.0470.06016.36
5.4.130.0500.05016.37
5.4.120.0470.06316.28
5.4.110.0330.04016.54
5.4.100.0500.04316.35
5.4.90.0470.04716.28
5.4.80.0470.04316.18
5.4.70.0430.03316.36
5.4.60.0430.03716.43
5.4.50.0570.05716.42
5.4.40.0530.05016.25
5.4.30.0500.05316.32
5.4.20.0470.03716.16
5.4.10.0370.03716.16
5.4.00.0530.06015.80
5.3.290.0530.06314.75
5.3.280.0530.07014.60
5.3.270.0430.05014.58
5.3.260.0470.03714.61
5.3.250.0570.04014.65
5.3.240.0370.04714.73
5.3.230.0530.03714.68
5.3.220.0430.04314.57
5.3.210.0400.05314.73
5.3.200.0400.04714.79
5.3.190.0530.06314.79
5.3.180.0570.04014.47
5.3.170.0400.04314.53
5.3.160.0370.04014.64
5.3.150.0370.04014.72
5.3.140.0370.04314.77
5.3.130.0530.06314.52
5.3.120.0530.06314.56
5.3.110.0570.05314.67
5.3.100.0370.04314.01
5.3.90.0500.02714.14
5.3.80.0370.04014.10
5.3.70.0500.03714.09
5.3.60.0430.03313.91
5.3.50.0470.04313.86
5.3.40.0530.06013.86
5.3.30.0570.05713.81
5.3.20.0500.04313.69
5.3.10.0600.05313.82
5.3.00.0400.04013.68
5.2.170.0300.03012.63
5.2.160.0300.03312.63
5.2.150.0430.04012.63
5.2.140.0400.03712.63
5.2.130.0470.04712.63
5.2.120.0400.03312.63
5.2.110.0370.02712.63
5.2.100.0270.03312.63
5.2.90.0400.04312.63
5.2.80.0430.02712.63
5.2.70.0330.03012.63
5.2.60.0330.03312.63
5.2.50.0300.03312.63
5.2.40.0270.03712.63
5.2.30.0430.04012.63
5.2.20.0270.07012.63
5.2.10.0330.03312.63
5.2.00.0400.03312.63
5.1.60.0270.03012.63
5.1.50.0400.02712.63
5.1.40.0270.04012.63
5.1.30.0330.04012.63
5.1.20.0300.03012.63
5.1.10.0430.02712.63
5.1.00.0500.03312.63
5.0.50.0230.04012.63
5.0.40.0200.03012.63
5.0.30.0170.04712.63
5.0.20.0170.02712.63
5.0.10.0130.04312.63
5.0.00.0270.05712.63
4.4.90.0170.02012.63
4.4.80.0170.01312.63
4.4.70.0130.03312.63
4.4.60.0130.02712.63
4.4.50.0270.02712.63
4.4.40.0200.04012.63
4.4.30.0200.02712.63
4.4.20.0130.02012.63
4.4.10.0330.01312.63
4.4.00.0200.04712.63
4.3.110.0200.03312.63
4.3.100.0170.02012.63
4.3.90.0200.02312.63
4.3.80.0200.04012.63
4.3.70.0170.02012.63
4.3.60.0200.01312.63
4.3.50.0170.03312.63
4.3.40.0130.05012.63
4.3.30.0100.02012.63
4.3.20.0100.03312.63
4.3.10.0070.03712.63
4.3.00.0070.03312.63

preferences:
45.21 ms | 401 KiB | 5 Q