3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var; echo 'before: '; var_dump($var); useRefs($var); echo 'after: '; var_dump($var); useRefs($var); echo 'last: '; var_dump($var); function useRefs(&$var) { if ($var === null) { $var = 'test'; } else { $var = null; } }
Output for 5.1.0 - 7.2.0
before: Notice: Undefined variable: var in /in/8etck on line 4 NULL after: string(4) "test" last: NULL
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: var in /in/8etck on line 3 before: Notice: Undefined variable: var in /in/8etck on line 4 NULL after: string(4) "test" last: NULL
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: var in /in/8etck on line 3 before: Notice: Undefined variable: var in /in/8etck on line 4 NULL after: string(4) "test" last: NULL