3v4l.org

run code in 300+ PHP versions simultaneously
<?php function period_to_timestamps($period) { switch($period) { case "last_7_days": $start = strtotime('-7 days'); $end = strtotime('now'); break; case "this_month": $start = strtotime('first day of this month'); $end = strtotime('now'); break; case "last_month": $start = strtotime('first day of last month'); $end = strtotime('last day of last month'); break; case "this_year": $start = strtotime('01-01-' . date('Y', strtotime('now'))); $end = strtotime('now'); break; case "last_year": $start = strtotime('01-01-' . date('Y', strtotime('now -1 year')); $end = strtotime('12-31-' . date('Y', strtotime('now -1 year')); break; default: $start = strtotime('now'); $end = strtotime('now'); } return array(date('m-d-Y', $start), date('m-d-Y', $end); } var_dump(period_to_timestamps('last_7_days')); var_dump(period_to_timestamps('this_month')); var_dump(period_to_timestamps('last_month')); var_dump(period_to_timestamps('this_year')); var_dump(period_to_timestamps('last_year'));

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)
5.4.290.0170.09012.51
5.4.280.0140.06312.41
5.4.270.0180.08612.41
5.4.260.0230.09712.41
5.4.250.0050.18412.41
5.4.240.0070.07412.41
5.4.230.0140.07912.40
5.4.220.0180.07912.40
5.4.210.0150.07312.40
5.4.200.0180.09812.40
5.4.190.0240.13612.39
5.4.180.0180.11412.39
5.4.170.0140.09112.40
5.4.160.0280.11612.40
5.4.150.0150.04612.39
5.4.140.0170.06412.09
5.4.130.0060.04912.07
5.4.120.0130.08412.03
5.4.110.0070.06612.04
5.4.100.0290.13512.03
5.4.90.0380.15712.03
5.4.80.0110.07112.03
5.4.70.0100.06012.02
5.4.60.0090.06712.02
5.4.50.0090.12612.02
5.4.40.0110.07012.02
5.4.30.0180.06912.01
5.4.20.0200.08012.00
5.4.10.0130.08312.02
5.4.00.0130.07311.50
5.3.280.0130.08112.71
5.3.270.0090.05312.72
5.3.260.0150.06912.72
5.3.250.0160.06912.72
5.3.240.0240.08212.72
5.3.230.0170.13312.71
5.3.220.0140.08512.68
5.3.210.0090.06812.68
5.3.200.0300.13812.68
5.3.190.0230.07212.68
5.3.180.0310.09612.67
5.3.170.0110.06512.67
5.3.160.0100.07112.67
5.3.150.0120.08412.67
5.3.140.0150.07412.66
5.3.130.0260.06012.65
5.3.120.0140.06712.66
5.3.110.0180.07412.66
5.3.100.0210.07612.13
5.3.90.0110.06012.11
5.3.80.0220.09512.10
5.3.70.0210.06712.09
5.3.60.0220.11412.09
5.3.50.0120.06912.03
5.3.40.0170.06912.03
5.3.30.0130.07411.99
5.3.20.0090.06911.77
5.3.10.0120.06411.74
5.3.00.0200.07211.72

preferences:
138.92 ms | 1386 KiB | 7 Q