3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php DEFINE('A', 3); $DAY = 1; class Days{ function __construct($d){ $this->day = $d ; } function addToDate(){ global $DAY; $this->day = $this->day + $DAY; return $this->day; } function modifyDay($d){ global $DAY; $DAY = $d; } function addDefine(){$this->day = $this->day + A;} } $p = new Days(5); echo $p->addToDate().' '; $p->modifyDay(8); echo $p->addToDate().' '; echo $p->addDefine().' ';
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
6 14
Output for 4.3.0 - 4.4.9
Notice: Undefined property: day in /in/eXMXo on line 10 1 9