3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $r = specialSetStartEndDate(['H (Zeitraum)' => '2015-07 2015-09']); echo($r); function specialSetStartEndDate($values, $params) { assert(array_key_exists('H (Zeitraum)', $values)); $period = $values['H (Zeitraum)']; $dates = explode(' ', $period); $start_date = DateTime::createFromFormat('Y-d', $dates[0]); $end_date = DateTime::createFromFormat('Y-d', $dates[1]); if (false == $start_date || false == $end_date) { throw new EWDRMI_Exception("Invalid input format of date '$period'", EWDRMI_Exception::BREAK_ROW); } $start_date->modify('first day of'); $end_date->modify('last day of'); $result = array( 'start_date' => $start_date->format('Y-m-d'), 'end_date' => $end_date->format('Y-m-d'), ); return $result; }
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function specialSetStartEndDate(), 1 passed in /in/C7g72 on line 4 and exactly 2 expected in /in/C7g72:7 Stack trace: #0 /in/C7g72(4): specialSetStartEndDate(Array) #1 {main} thrown in /in/C7g72 on line 7
Process exited with code 255.
Output for 5.4.11 - 7.0.20
Warning: Missing argument 2 for specialSetStartEndDate(), called in /in/C7g72 on line 4 and defined in /in/C7g72 on line 7 Notice: Array to string conversion in /in/C7g72 on line 5 Array
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/C7g72 on line 4
Process exited with code 255.