3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function &counter() { static $c = 0; $c++; echo $c."\n"; return $c; } $cnt1 = counter(); $cnt1++; // this does not influence counter $cnt2 =& counter(); $cnt2++; // this does influence counter counter();
based on XcCom
Output for 4.3.0 - 7.1.0
1 2 4