3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function &collector() { static $collection = array(); return $collection; } $collect = &collector(); $collect[] = 'foo'; print_r(collector()); $collect[] = 'bar'; print_r(collector());
Output for 4.3.0 - 7.2.0
Array ( [0] => foo ) Array ( [0] => foo [1] => bar )