3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getDay($day) { $days[] = 'Monday' => 1, 'Tuesday' => 2, 'Wednesday' => 3, 'Thursday' => 4, 'Friday' => 5, 'Saturday' => 6, 'Sunday' => 7; $today = new \DateTime(); $today->setISODate($today->format('o'), $today->format('W'), $days[ucfirst($day)]); return $today; } var_dump(getDay('Monday')->format('l dS F Y')); var_dump(getDay('Friday')->format('l dS F Y'));
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/EIH5W on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_DOUBLE_ARROW in /in/EIH5W on line 4
Process exited with code 255.