3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //$hours=array("1","2","3","4","5","6","7","8","9"); $holiday=array('sunday','saturday'); $start='2016-01-26 04:30:0'; $end='2016-01-31 04:30:00'; $b=date_create($a); $c=date_format($b,'m-d-y H:i:s'); $d=date('H',$c); //echo date($c+'1day'); //echo $e=($d+'1hour'); $diff=date_diff($end,$start); echo $diff->format("%R%a days"); ?>
based on GpGXk
Output for 7.3.0alpha1
Notice: Undefined variable: a in /in/sQFvl on line 6 Notice: A non well formed numeric value encountered in /in/sQFvl on line 8 Warning: date_diff() expects parameter 1 to be DateTimeInterface, string given in /in/sQFvl on line 11 Fatal error: Uncaught Error: Call to a member function format() on bool in /in/sQFvl:12 Stack trace: #0 {main} thrown in /in/sQFvl on line 12
Process exited with code 255.
Output for 7.0.0 - 7.2.6
Notice: Undefined variable: a in /in/sQFvl on line 6 Notice: A non well formed numeric value encountered in /in/sQFvl on line 8 Warning: date_diff() expects parameter 1 to be DateTimeInterface, string given in /in/sQFvl on line 11 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/sQFvl:12 Stack trace: #0 {main} thrown in /in/sQFvl on line 12
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Notice: Undefined variable: a in /in/sQFvl on line 6 Notice: A non well formed numeric value encountered in /in/sQFvl on line 8 Warning: date_diff() expects parameter 1 to be DateTimeInterface, string given in /in/sQFvl on line 11 Fatal error: Call to a member function format() on boolean in /in/sQFvl on line 12
Process exited with code 255.
Output for 5.5.8 - 5.5.38
Notice: Undefined variable: a in /in/sQFvl on line 6 Notice: A non well formed numeric value encountered in /in/sQFvl on line 8 Warning: date_diff() expects parameter 1 to be DateTimeInterface, string given in /in/sQFvl on line 11 Fatal error: Call to a member function format() on a non-object in /in/sQFvl on line 12
Process exited with code 255.
Output for 5.5.0 - 5.5.7
Notice: Undefined variable: a in /in/sQFvl on line 6 Notice: A non well formed numeric value encountered in /in/sQFvl on line 8 Warning: date_diff() expects parameter 1 to be DateTime, string given in /in/sQFvl on line 11 Fatal error: Call to a member function format() on a non-object in /in/sQFvl on line 12
Process exited with code 255.