3v4l.org

run code in 300+ PHP versions simultaneously
<?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.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 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.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 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

preferences:
184.36 ms | 402 KiB | 198 Q