3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $v = array(10, 20); $a = 'v'; $$a[0] = 5; // $v is [5, 20] var_dump($v); $v = array(10, 20); $a = 'v'; ${$a[0]} = 5; // $v is 5 var_dump($v); $v = array(10, 20); $a = 'v'; ${$a}[0] = 5; // $ gets first shot at $a, $v is [5, 20] var_dump($v);
based on 0JBnF
Output for 7.0.0 - 7.2.0
array(2) { [0]=> int(5) [1]=> int(20) } int(5) array(2) { [0]=> int(5) [1]=> int(20) }
Output for 5.3.21 - 5.6.28
int(5) int(5) array(2) { [0]=> int(5) [1]=> int(20) }