3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $process = '27-Jun-2017 15:13:46'; $disclosure = '26/10/1992'; function process_date ($date) { if (!$formattedDate) { $formattedDate = DateTime::createFromFormat('d-M-Y H:i:s', $date); } var_dump($formattedDate->format('jS M Y')); } process_date($process); process_date($disclosure);
based on smkPL
Output for 7.3.0alpha1 - 7.3.0beta1
Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 string(13) "27th Jun 2017" Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 Fatal error: Uncaught Error: Call to a member function format() on bool in /in/G5NlD:12 Stack trace: #0 /in/G5NlD(16): process_date('26/10/1992') #1 {main} thrown in /in/G5NlD on line 12
Process exited with code 255.
Output for 7.0.0 - 7.2.6
Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 string(13) "27th Jun 2017" Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/G5NlD:12 Stack trace: #0 /in/G5NlD(16): process_date('26/10/1992') #1 {main} thrown in /in/G5NlD on line 12
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 string(13) "27th Jun 2017" Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function format() on a non-object (boolean)' in /in/G5NlD:12 Stack trace: #0 /in/G5NlD(16): process_date() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 string(13) "27th Jun 2017" Notice: Undefined variable: formattedDate in /in/G5NlD on line 8 Fatal error: Call to a member function format() on boolean in /in/G5NlD on line 12
Process exited with code 255.