3v4l.org

run code in 300+ PHP versions simultaneously
<?php $punch_in = "2019-07-01 09:00:00"; $punch_out = "2019-07-01 18:00:00"; $in_threshold = "2019-07-01 08:15:00"; $out_threshold = "2019-07-01 17:15:00"; $exact_in_threshold = "2019-07-01 08:00:00"; $exact_out_threshold = "2019-07-01 17:00:00"; function generateAttendance( $punch_in, $punch_out , $in_threshold, $out_threshold , $exact_in_threshold, $exact_out_threshold){ $lates = 0; $overtime = 0; // If punch_in is late = punch_in and late + 1 if ($punch_in > $in_threshold) { $start = $punch_in; $lates = +1; } // If punch_in is early = exact_time else { $start = $exact_in_threshold; } // If punch_out is early = punch_out if ($punch_out < $out_threshold) { $end = $punch_out; } // If pucn_out is overtime = exact_end and overtime + 1 else { $end = $exact_out_threshold; $overtime =1; } // If both punch in and punch_out is within threshold if ((( $exact_in_threshold >= $in_threshold ) && ( $exact_in_threshold <= $punch_in )) && (( $exact_out_threshold >= $out_threshold ) && ( $exact_out_threshold <= $punch_out ))) { $start = $punch_in; $end = $punch_out; } // If punch_in is within threshold, start = punch_in and end = exact_end else if ((( $exact_in_threshold >= $in_threshold ) && ( $exact_in_threshold <= $punch_in )) && $punch_out > $out_threshold) { $start = $punch_in; $end = $exact_out_threshold; } return array('start' => $start, 'end' => $end, 'lates' => $lates, 'overtime' => $overtime); } $result = generateAttendance( $punch_in, $punch_out , $in_threshold, $out_threshold , $exact_in_threshold, $exact_out_threshold); print_r($result);

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.0130.00618.56
8.3.50.0130.00822.10
8.3.40.0110.00418.66
8.3.30.0130.00618.84
8.3.20.0080.00021.91
8.3.10.0040.00420.25
8.3.00.0040.00421.89
8.2.180.0100.00718.29
8.2.170.0110.00422.96
8.2.160.0100.00319.46
8.2.150.0000.00824.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0030.00519.79
8.2.110.0070.00320.97
8.2.100.0060.01017.91
8.2.90.0060.00317.85
8.2.80.0040.00418.03
8.2.70.0050.00317.75
8.2.60.0080.00017.50
8.2.50.0080.00017.55
8.2.40.0080.00017.75
8.2.30.0040.00419.41
8.2.20.0000.00718.26
8.2.10.0040.00419.25
8.2.00.0040.00419.20
8.1.280.0060.01025.92
8.1.270.0040.00422.06
8.1.260.0080.00326.35
8.1.250.0000.00728.09
8.1.240.0000.01119.55
8.1.230.0100.00021.00
8.1.220.0060.00317.76
8.1.210.0000.00818.89
8.1.200.0040.00417.23
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0080.00017.62
8.1.160.0040.00418.97
8.1.150.0000.00719.01
8.1.140.0040.00420.92
8.1.130.0040.00417.52
8.1.120.0000.00717.57
8.1.110.0000.00817.39
8.1.100.0030.00617.39
8.1.90.0050.00317.38
8.1.80.0040.00417.41
8.1.70.0080.00017.36
8.1.60.0080.00417.50
8.1.50.0080.00017.59
8.1.40.0030.00617.58
8.1.30.0080.00017.66
8.1.20.0040.00417.71
8.1.10.0080.00017.41
8.1.00.0040.00417.55
8.0.300.0030.00319.89
8.0.290.0060.00316.75
8.0.280.0070.00018.51
8.0.270.0000.00716.82
8.0.260.0000.00716.91
8.0.250.0000.00716.93
8.0.240.0070.00016.96
8.0.230.0030.00516.96
8.0.220.0040.00416.92
8.0.210.0000.00716.91
8.0.200.0040.00417.04
8.0.190.0030.00517.04
8.0.180.0080.00016.92
8.0.170.0040.00416.99
8.0.160.0080.00016.96
8.0.150.0050.00216.93
8.0.140.0040.00416.92
8.0.130.0060.00013.39
8.0.120.0080.00016.83
8.0.110.0000.00816.99
8.0.100.0050.00216.78
8.0.90.0040.00416.91
8.0.80.0100.01016.83
8.0.70.0040.00416.88
8.0.60.0050.00216.91
8.0.50.0000.00716.78
8.0.30.0090.00917.13
8.0.20.0130.00617.13
8.0.10.0030.00516.95
8.0.00.0070.01116.83
7.4.330.0030.00316.79
7.4.320.0060.00016.65
7.4.300.0060.00016.55
7.4.290.0080.00016.43
7.4.280.0000.00716.63
7.4.270.0030.00316.52
7.4.260.0040.00416.42
7.4.250.0040.00416.52
7.4.240.0020.00616.56
7.4.230.0040.00416.70
7.4.220.0060.00116.57
7.4.210.0040.01216.62
7.4.200.0040.00416.72
7.4.130.0120.00616.52
7.4.120.0090.00916.64
7.4.110.0120.00616.54
7.4.100.0100.00716.68
7.4.90.0090.00916.40
7.4.80.0150.00319.39
7.4.70.0040.01216.39
7.4.60.0090.00916.48
7.4.50.0040.01116.41
7.4.40.0090.00916.43
7.4.10.0080.00915.72
7.4.00.0080.00915.33
7.3.330.0040.00413.41
7.3.320.0000.00713.16
7.3.310.0040.00416.29
7.3.300.0030.00316.34
7.3.290.0030.00316.41
7.3.280.0040.01816.26
7.3.260.0120.00616.39
7.3.240.0100.01016.43
7.3.230.0080.01316.38
7.3.210.0060.01216.40
7.3.200.0090.00916.38
7.3.190.0090.00616.59
7.3.180.0110.00716.38
7.3.170.0070.01516.72
7.3.160.0090.00916.46
7.3.130.0060.00815.80
7.3.120.0080.00915.51
7.3.110.0080.01015.45
7.3.100.0070.00915.29
7.3.90.0060.00815.51
7.3.80.0070.00515.30
7.3.70.0080.00415.25
7.3.60.0030.00915.18
7.3.50.0060.00615.05
7.3.40.0060.00715.12
7.3.30.0070.00815.14
7.3.20.0100.00516.47
7.3.10.0090.00816.49
7.3.00.0070.00816.48
7.2.330.0140.00416.43
7.2.320.0030.01316.51
7.2.310.0100.00716.59
7.2.300.0080.00816.54
7.2.290.0080.00916.73
7.2.260.0090.00615.79
7.2.250.0050.01315.49
7.2.240.0040.01215.40
7.2.230.0030.01415.32
7.2.220.0070.01015.60
7.2.210.0060.00715.39
7.2.200.0050.00715.33
7.2.190.0040.01015.29
7.2.180.0060.00815.29
7.2.170.0060.00815.24
7.2.160.0050.00815.21
7.2.150.0090.00716.68
7.2.140.0090.00716.53
7.2.130.0090.00616.69
7.2.120.0100.00616.63
7.2.110.0090.00716.56
7.2.100.0090.00916.70
7.2.90.0120.00516.74
7.2.80.0090.00616.54
7.2.70.0100.00516.71
7.2.60.0110.00816.87
7.2.50.0070.00916.73
7.2.40.0080.00816.79
7.2.30.0060.00916.59
7.2.20.0060.00816.84
7.2.10.0080.00716.66
7.2.00.0100.00716.58
7.1.330.0010.01216.31
7.1.320.0040.01016.26
7.1.310.0070.00416.28
7.1.300.0110.00615.71
7.1.290.0050.01015.81
7.1.280.0060.00715.71
7.1.270.0080.00715.63
7.1.260.0060.01015.62
7.1.250.0070.00615.64
7.1.240.0060.00516.50
7.1.230.0070.00516.50
7.1.220.0090.00416.48
7.1.210.0100.00316.58
7.1.200.0060.00716.34
7.1.190.0050.00716.50
7.1.180.0020.01116.52
7.1.170.0070.00516.51
7.1.160.0050.00816.54
7.1.150.0030.00916.51
7.1.140.0070.00316.61
7.1.130.0030.00916.49
7.1.120.0060.01016.51
7.1.110.0050.00716.43
7.1.100.0070.00816.65
7.1.90.0070.00516.56
7.1.80.0050.00516.39
7.1.70.0050.00616.48
7.1.60.0070.00516.70
7.1.50.0060.00316.46
7.1.40.0050.01016.56
7.1.30.0050.00716.62
7.1.20.0050.00916.39
7.1.10.0050.00716.54
7.1.00.0020.01116.52

preferences:
33.38 ms | 401 KiB | 5 Q