3v4l.org

run code in 200+ PHP versions simultaneously
<?php $arr = []; function test() { global $arr; return $arr[] = 'test'; } var_dump(test(), $arr);
based on si5Js
Output for 7.2.0 - 7.4.1
string(4) "test" array(1) { [0]=> string(4) "test" }