3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //create both dates (birthday and today). $birthday = date_create($this->birthday); $today = date_create(date('Y-m-d')); //check if the dates are valid. if (($birthday !== false && $today !== false) && ($birthday < $today)) { return date_diff($birthday, $today)->y; } else { return -1; }
based on 6SQdK
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/DZVUg:3 Stack trace: #0 {main} thrown in /in/DZVUg on line 3
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Using $this when not in object context in /in/DZVUg on line 3
Process exited with code 255.