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 fcr2q
Output for 4.4.0 - 4.4.9, 7.0.0 - 7.1.0
1 2 Notice: Only variables should be assigned by reference in /in/QNXfq on line 12 3
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4, hhvm-3.10.0 - 3.12.0
1 2 3
Output for 5.0.5 - 5.6.28
1 2 Strict Standards: Only variables should be assigned by reference in /in/QNXfq on line 12 3