3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $months = array(); for ($i = 1; $i <= 12; $i++) { $datetime = \DateTime::createFromFormat('!m', $i); $months[$i] = $formatter->format($datetime); } return $months;
Output for 7.0.5 - 7.3.0beta1
Notice: Undefined variable: formatter in /in/4bFFr on line 6 Fatal error: Uncaught Error: Call to a member function format() on null in /in/4bFFr:6 Stack trace: #0 {main} thrown in /in/4bFFr on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: formatter in /in/4bFFr on line 6 Fatal error: Uncaught Error: Call to a member function format() on unknown in /in/4bFFr:6 Stack trace: #0 {main} thrown in /in/4bFFr on line 6
Process exited with code 255.
Output for hhvm-3.12.14 - 3.17.3
Notice: Undefined variable: formatter in /in/4bFFr on line 6 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function format() on a non-object (null)' in /in/4bFFr:6 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Undefined variable: formatter in /in/4bFFr on line 6 Fatal error: Call to a member function format() on null in /in/4bFFr on line 6
Process exited with code 255.
Output for 5.5.0 - 5.5.38
Notice: Undefined variable: formatter in /in/4bFFr on line 6 Fatal error: Call to a member function format() on a non-object in /in/4bFFr on line 6
Process exited with code 255.