3v4l.org

run code in 300+ PHP versions simultaneously
<?php //echo date('r', strtotime('last sunday', strtotime('6 April 1991'))); function align_timestamp_to($stamp, $unit, $past){ // timestamp, unit string, start/end static $modes = array( 'week' => 'last monday' 'month' => 'first day of month' ); // TODO error out if unknown $unit $offset = $modes[$unit]; if($past == 'end')$offset = '+1 '.$unit.' '.$offset; $new = strtotime($offset, $stamp); } foreach(array( array(strtotime('4 Apr 2012'), 'week', 'start'), array(strtotime('4 Apr 2012'), 'week', 'end'), ) as $test)echo date('r', $test[0]).' aligned '.$test[2].' of '.$test[1].' yields '.date('r', align_timestamp_to($test[0], $test[1], $test[2]));

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.90.0400.05213.56
5.4.80.0390.04713.54
5.4.70.0290.04413.47
5.4.60.0340.04313.53
5.4.50.0330.04613.47
5.4.40.0310.04213.47
5.4.30.0320.04113.54
5.4.20.0310.04513.54
5.4.10.0460.04613.53
5.4.00.0370.04712.95
5.3.190.0490.05713.31
5.3.180.0350.04713.26
5.3.170.0380.04013.38
5.3.160.0350.04513.32
5.3.150.0350.04813.35
5.3.140.0360.04413.30
5.3.130.0380.04613.25
5.3.120.0430.04413.32
5.3.110.0380.05913.29
5.3.100.0360.05012.84
5.3.90.0290.04712.69
5.3.80.0380.04512.71
5.3.70.0320.04812.70
5.3.60.0360.04512.74
5.3.50.0360.05112.63
5.3.40.0410.04812.64
5.3.30.0420.05512.67
5.3.20.0380.04212.41
5.3.10.0410.04112.32
5.3.00.0330.04612.32

preferences:
149.04 ms | 1394 KiB | 7 Q