3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class myclass{ public static $i = 0; public function one($called_from = null){ if ( $called_from != 'two'){ return $this->two(); } self::$i += 1; echo self::$i.PHP_EOL; } public function two(){ return $this->one(__FUNCTION__); } } $obj = new myclass; $obj->one();
based on aVZD7
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
1