3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // todays date $today = date("Ymd"); function ageChange(){ list($year,$month,$day) = explode("-", $birth_date); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($day_diff < 0 || $month_diff < 0) $year_diff--; return $year_diff; } //Call the age function ageChange();
Output for 7.1.0
Notice: Undefined variable: birth_date in /in/uLTic on line 8 Notice: Undefined offset: 1 in /in/uLTic on line 8 Notice: Undefined offset: 2 in /in/uLTic on line 8 Warning: A non-numeric value encountered in /in/uLTic on line 9
Output for 7.0.0 - 7.0.14
Notice: Undefined variable: birth_date in /in/uLTic on line 8 Notice: Undefined offset: 1 in /in/uLTic on line 8 Notice: Undefined offset: 2 in /in/uLTic on line 8
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: birth_date in /in/uLTic on line 8 Notice: Undefined index: 2 in /in/uLTic on line 8 Notice: Undefined index: 1 in /in/uLTic on line 8
Output for 5.3.0 - 5.6.28
Notice: Undefined variable: birth_date in /in/uLTic on line 8 Notice: Undefined offset: 2 in /in/uLTic on line 8 Notice: Undefined offset: 1 in /in/uLTic on line 8