3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dt1 = getdate(); $dt2 = getdate(); $date1 = date_create("".$dt1.""); $date2 = date_create("".$dt2.""); $dateDiff = date_diff($date2, $date1); $probDays = $dateDiff->days; $probMon = $dateDiff->m; $probYear = $dateDiff->y; $month = $probDays / 30; $totLeave = $month * 1; if($month > $probmon) { $totLeave = $totLeave + 1; } ?>
Output for 5.5.8 - 7.1.0
Notice: Array to string conversion in /in/V9KXV on line 5 Notice: Array to string conversion in /in/V9KXV on line 7 Warning: date_diff() expects parameter 1 to be DateTimeInterface, boolean given in /in/V9KXV on line 9 Notice: Trying to get property of non-object in /in/V9KXV on line 11 Notice: Trying to get property of non-object in /in/V9KXV on line 12 Notice: Trying to get property of non-object in /in/V9KXV on line 13 Notice: Undefined variable: probmon in /in/V9KXV on line 18
Output for 5.4.0 - 5.5.7
Notice: Array to string conversion in /in/V9KXV on line 5 Notice: Array to string conversion in /in/V9KXV on line 7 Warning: date_diff() expects parameter 1 to be DateTime, boolean given in /in/V9KXV on line 9 Notice: Trying to get property of non-object in /in/V9KXV on line 11 Notice: Trying to get property of non-object in /in/V9KXV on line 12 Notice: Trying to get property of non-object in /in/V9KXV on line 13 Notice: Undefined variable: probmon in /in/V9KXV on line 18
Output for 5.3.0 - 5.3.29
Warning: date_diff() expects parameter 1 to be DateTime, boolean given in /in/V9KXV on line 9 Notice: Trying to get property of non-object in /in/V9KXV on line 11 Notice: Trying to get property of non-object in /in/V9KXV on line 12 Notice: Trying to get property of non-object in /in/V9KXV on line 13 Notice: Undefined variable: probmon in /in/V9KXV on line 18
Output for 5.2.6 - 5.2.17
Fatal error: Call to undefined function date_diff() in /in/V9KXV on line 9
Process exited with code 255.
Output for 5.2.0 - 5.2.5
Warning: date_create(): Failed to parse time string (Array) at position 0 (A): The timezone could not be found in the database in /in/V9KXV on line 5 Warning: date_create(): Failed to parse time string (Array) at position 0 (A): The timezone could not be found in the database in /in/V9KXV on line 7 Fatal error: Call to undefined function date_diff() in /in/V9KXV on line 9
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function date_create() in /in/V9KXV on line 5
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_create() in /in/V9KXV on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_create() in /in/V9KXV on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_create() in /in/V9KXV on line 5