3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = "22-09-2017"; function getDay($day,$date) { $days = ['Monday' => 1, 'Tuesday' => 2, 'Wednesday' => 3, 'Thursday' => 4, 'Friday' => 5, 'Saturday' => 6, 'Sunday' => 7]; $date = new \DateTime($date); $date->setISODate((int)$today->format('o'), (int)$today->format('W'), $days[ucfirst($day)]); return $today; } echo getDay('Monday',$dt)->format("d-m-Y");
based on ANJfO
Output for 7.0.5 - 7.3.0beta1
Notice: Undefined variable: today in /in/6hegY on line 8 Fatal error: Uncaught Error: Call to a member function format() on null in /in/6hegY:8 Stack trace: #0 /in/6hegY(11): getDay('Monday', Object(DateTime)) #1 {main} thrown in /in/6hegY on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: today in /in/6hegY on line 8 Fatal error: Uncaught Error: Call to a member function format() on unknown in /in/6hegY:8 Stack trace: #0 /in/6hegY(11): getDay('Monday', Object(DateTime)) #1 {main} thrown in /in/6hegY on line 8
Process exited with code 255.
Output for hhvm-3.22.0
Notice: Undefined variable: today in /in/6hegY on line -1 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function format() on a non-object (null)' in /in/6hegY:-1 Stack trace: #0 /in/6hegY(-1): getDay() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Notice: Undefined variable: today in /in/6hegY on line 8 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function format() on a non-object (null)' in /in/6hegY:8 Stack trace: #0 /in/6hegY(11): getDay() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Undefined variable: today in /in/6hegY on line 8 Fatal error: Call to a member function format() on null in /in/6hegY on line 8
Process exited with code 255.