3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array('05:11','05:21','05:24','05:31','05:34','05:41','05:44','05:50','05:54'); function getClosest($search, $arr) { $item = null; while ($key = key($arr) !== null) { $current = current($arr); $item = next($arr); if ( strtotime($current) < strtotime($search) && strtotime($item) >= strtotime($search) ) { break; } else if ( strtotime($current) > strtotime($search) ) { $item = $current; break; } } return $item; } print_r([ getClosest('05:50', $arr), getClosest('05:34', $arr), getClosest('05:52', $arr), getClosest('05:15', $arr), getClosest('05:10', $arr), ]);

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.5.00.0110.01020.38
8.4.150.0020.00114.05
8.4.140.0160.01017.81
8.4.130.0070.00317.70
8.4.120.0110.00820.66
8.4.110.0080.00519.01
8.4.100.0130.00917.94
8.4.90.0060.00318.98
8.4.80.0040.00518.11
8.4.70.0060.00418.09
8.4.60.0110.00519.03
8.4.50.0120.01119.89
8.4.40.0040.01618.03
8.4.30.0130.00617.95
8.4.20.0090.01220.58
8.4.10.0060.00317.68
8.3.280.0140.00720.31
8.3.270.0130.00616.64
8.3.260.0110.01016.57
8.3.250.0140.00519.01
8.3.240.0090.01116.67
8.3.230.0120.00816.88
8.3.220.0050.00217.11
8.3.210.0110.00716.64
8.3.200.0040.00516.60
8.3.190.0120.00619.18
8.3.180.0080.00216.80
8.3.170.0090.01019.09
8.3.160.0000.00916.81
8.3.150.0040.01419.23
8.3.140.0060.01216.59
8.3.130.0040.00418.72
8.3.120.0110.00420.48
8.3.110.0080.00820.94
8.3.100.0040.01124.06
8.3.90.0070.00726.77
8.3.80.0080.00417.97
8.3.70.0060.00916.81
8.3.60.0000.01518.68
8.3.50.0130.01018.25
8.3.40.0120.00318.96
8.3.30.0040.01118.78
8.3.20.0080.00018.98
8.3.10.0030.00521.89
8.3.00.0060.00323.61
8.2.290.0090.00520.57
8.2.280.0100.00818.29
8.2.270.0150.00317.38
8.2.260.0190.00018.91
8.2.250.0090.00616.59
8.2.240.0000.01617.25
8.2.230.0030.00622.58
8.2.220.0030.00737.54
8.2.210.0040.00426.77
8.2.200.0070.00318.41
8.2.190.0110.00418.51
8.2.180.0130.01016.88
8.2.170.0100.00722.96
8.2.160.0070.00722.08
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00821.00
8.2.120.0080.00026.35
8.2.110.0070.00319.30
8.2.100.0040.00817.96
8.2.90.0040.00418.03
8.2.80.0040.00418.04
8.2.70.0060.00318.05
8.2.60.0060.00318.22
8.2.50.0040.00418.10
8.2.40.0060.00321.02
8.2.30.0000.00820.71
8.2.20.0030.00618.15
8.2.10.0070.00018.13
8.2.00.0030.00518.43
8.1.330.0130.00623.56
8.1.320.0130.00716.31
8.1.310.0110.00718.80
8.1.300.0070.00420.13
8.1.290.0000.01030.84
8.1.280.0090.00625.92
8.1.270.0040.00423.96
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0000.00919.25
8.1.230.0060.00620.88
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00917.48
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0000.00918.77
8.1.160.0000.00818.97
8.1.150.0040.00419.02
8.1.140.0040.00418.85
8.1.130.0040.00422.06
8.1.120.0000.00717.69
8.1.110.0060.00317.67
8.1.100.0080.00317.68
8.1.90.0000.00817.69
8.1.80.0040.00417.54
8.1.70.0040.00417.64
8.1.60.0030.00617.77
8.1.50.0050.00217.66
8.1.40.0040.00417.59
8.1.30.0040.00417.84
8.1.20.0040.00417.82
8.1.10.0000.00917.70
8.1.00.0040.00417.64
8.0.300.0040.00420.02
8.0.290.0090.00016.88
8.0.280.0050.00218.51
8.0.270.0080.00017.05
8.0.260.0060.00018.60
8.0.250.0040.00417.07
8.0.240.0030.00317.24
8.0.230.0000.00817.07
8.0.220.0070.00017.10
8.0.210.0040.00417.13
8.0.200.0030.00317.05
8.0.190.0070.00017.12
8.0.180.0080.00017.12
8.0.170.0050.00316.97
8.0.160.0000.00717.14
8.0.150.0100.00017.11
8.0.140.0050.00317.00
8.0.130.0040.00313.43
8.0.120.0050.00317.15
8.0.110.0060.00317.02
8.0.100.0000.00716.99
8.0.90.0050.00317.14
8.0.80.0050.01117.12
8.0.70.0000.00716.98
8.0.60.0030.00517.17
8.0.50.0040.00416.91
8.0.30.0110.00817.33
8.0.20.0100.00917.40
8.0.10.0000.00717.20
8.0.00.0140.00817.01
7.4.330.0000.00515.55
7.4.320.0060.00016.77
7.4.300.0030.00316.61
7.4.290.0000.00716.77
7.4.280.0000.00816.70
7.4.270.0080.00016.82
7.4.260.0040.00416.74
7.4.250.0040.00416.62
7.4.240.0070.00016.74
7.4.230.0050.00216.55
7.4.220.0040.00416.77
7.4.210.0070.00916.78
7.4.200.0040.00416.80
7.4.160.0110.00516.68
7.4.140.0110.00917.86
7.4.130.0060.01216.86
7.4.120.0080.01116.63
7.4.110.0140.00916.79
7.4.100.0080.01316.72
7.4.90.0160.00316.80
7.4.80.0060.01219.39
7.4.70.0140.01016.67
7.4.60.0040.01416.64
7.4.50.0070.01016.67
7.4.40.0140.01016.81
7.4.00.0030.01314.91
7.3.330.0060.00013.27
7.3.320.0050.00013.41
7.3.310.0000.00816.29
7.3.300.0020.00516.47
7.3.290.0000.00716.45
7.3.280.0040.01116.45
7.3.260.0140.00616.57
7.3.240.0140.00416.61
7.3.230.0090.00916.72
7.3.210.0130.01016.57
7.3.200.0080.00816.41
7.3.190.0090.00616.50
7.3.180.0100.01316.82
7.3.170.0130.00316.57
7.3.160.0090.00616.65
7.2.330.0120.00616.76
7.2.320.0070.01416.72
7.2.310.0050.01116.97
7.2.300.0060.01017.01
7.2.290.0070.01017.01
7.2.100.2970.00714.96
7.2.90.0240.00614.80
7.2.80.3450.01315.03
7.2.70.0500.00914.95
7.2.60.0300.00414.89
7.2.50.0660.01414.82
7.2.40.0560.00615.04
7.2.30.0140.01115.03
7.2.20.0170.01415.02
7.2.10.0130.00715.20
7.2.00.0130.00915.07
7.1.220.3080.00313.91
7.1.210.2920.00713.88
7.1.200.0170.00414.04
7.1.190.3570.00713.98
7.1.180.0230.01113.82
7.1.170.0780.01013.56
7.1.160.2880.00013.87
7.1.150.0170.00314.02
7.1.140.0160.00613.96
7.1.130.0290.00014.03
7.1.120.0160.00313.88
7.1.110.0520.00613.57
7.1.100.1700.01013.80
7.1.90.0140.01114.04
7.1.80.0910.00913.74
7.1.70.0110.01013.89
7.1.60.0270.01331.91
7.1.50.2260.01031.77
7.1.40.0830.00731.56
7.1.30.0450.00031.73
7.1.20.0260.01031.59
7.1.10.1700.01013.73
7.1.00.1430.01013.85
5.6.380.0070.01114.42

preferences:
30.22 ms | 403 KiB | 5 Q