3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function RS_GET_DATE_WITH_DAYNAME_POSITION_FORMAT($day_name, $position = 'future', $today_is_past = true, $format = 'Y-m-d H:i:s') { $day = ucfirst($day_name); $today_name = date('l', time()); $today = date('Y-m-d 00:00:00', time()); // Je force l'heure à minuit sinon dans certain cas nous sommes déjà dans le future alors qu'on est aujourd'hui $next = date($format, strtotime('next '.$day_name)); $last = date($format, strtotime('last '.$day_name)); if($position == 'future') { if($today_name != $day) { return $next; } else { if($today_is_past) return $next; else return $today; } } else { if($today_name != $day) { return $last; } else { if($today_is_past) return $today; else return $last; } } } echo ucfirst('Sunday')
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/3lXYM on line 36
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/3lXYM on line 36
Process exited with code 255.