3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { function run() { $this->arr = array('item'); var_dump(key($this->arr)); // dumps 0 // this unexpectedly advances the internal array pointer foreach ($this->getArr() as $v) {} var_dump(key($this->arr)); // dumps NULL } function getArr() { // is NOT returned by reference return $this->arr; } } $test = new Test; $test->run();
Output for hhvm-3.12.0, 7.0.0 - 7.1.0
int(0) int(0)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.6.28
int(0) NULL