3v4l.org

run code in 300+ PHP versions simultaneously
<?php class day(){ public $date; public function __construct() { $this->date = time(); } /** * Should I write code today? * @param (array) $todos Current list of TODOs * @return boolean I should code if true. */ public function doCode((array) $todos) { //return true; //Never stop coding $chore = next($todos); while($chore && $chore->priority < 3 ) $chore = next($todos); return $chore === false; } /** * Is the date in teh weekend? * @param string $date String date to check * @return boolean True if date is in the weekend */ protected function isWeekend($date) { return date('w', strtotime($date)) % 6 == 0; } } /* End of file day.php */ /* Location: ./life/modules/day/day.php */ $agenda = array( (object)array('priority'=>1) ,(object)array('priority'=>1) ,(object)array('priority'=>1) ,(object)array('priority'=>1) ); $day = new day(); $i = 1; while($i< 10) { echo var_dump($day->doCode($agenda)) . "\n"; $day->date = strtotime($day->date. ' + 1 days'); }

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.230.0090.04512.38
5.4.220.0150.04312.38
5.4.210.0140.04512.38
5.4.200.0120.04612.38
5.4.190.0340.06712.38
5.4.180.0160.04312.38
5.4.170.0120.04612.39
5.4.160.0160.04412.38
5.4.150.0140.04912.38
5.4.140.0210.06312.07
5.4.130.0140.04512.05
5.4.120.0110.04912.02
5.4.110.0100.04212.01
5.4.100.0150.03912.01
5.4.90.0100.04612.01
5.4.80.0140.03812.01
5.4.70.0110.04012.01
5.4.60.0090.04312.01
5.4.50.0100.04112.01
5.4.40.0140.04311.99
5.4.30.0160.05211.99
5.4.20.0180.04711.99
5.4.10.0130.04511.99
5.4.00.0180.04111.48
5.3.280.0130.05112.71
5.3.270.0150.04312.72
5.3.260.0140.04212.72
5.3.250.0160.04212.72
5.3.240.0170.04112.72
5.3.230.0150.04512.71
5.3.220.0180.03812.68
5.3.210.0450.05812.68
5.3.200.0160.07212.68
5.3.190.0130.04512.68
5.3.180.0120.04312.67
5.3.170.0210.06112.67
5.3.160.0170.04212.67
5.3.150.0260.07612.67
5.3.140.0160.04112.66
5.3.130.0240.06412.66
5.3.120.0200.05412.66
5.3.110.0170.04012.65
5.3.100.0120.04312.12
5.3.90.0130.04112.09
5.3.80.0120.04212.08
5.3.70.0190.03812.08
5.3.60.0130.04212.07
5.3.50.0160.04212.01
5.3.40.0150.04912.01
5.3.30.0160.04511.96
5.3.20.0160.04611.74
5.3.10.0110.04711.71
5.3.00.0140.04211.70

preferences:
142.52 ms | 1394 KiB | 7 Q