3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function getPromoFullMonthHorizon(DateTime $date) { $actualDate = new DateTime($this->f->PwDate()); $actualMonths = $actualDate->format('Y')*12 + $actualDate->format('m'); $months = $date->format('Y')*12 + $date->format('m'); return $months - $actualMonths; } var_dump(getPromoFullMonthHorizon(new DateTime('2016-01-01')));
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/VTnDu:5 Stack trace: #0 /in/VTnDu(12): getPromoFullMonthHorizon(Object(DateTime)) #1 {main} thrown in /in/VTnDu on line 5
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Using $this when not in object context in /in/VTnDu on line 5
Process exited with code 255.