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'); }
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
Parse error: syntax error, unexpected '(', expecting '{' in /in/CR4Ru on line 4
Process exited with code 255.

preferences:
180.47 ms | 1387 KiB | 60 Q