3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 'foo' => array( 'bar' => 42 ) ); $b = $a; $propertyPath = array('foo', 'bar'); $value = &$b; foreach ($propertyPath as $key) { $value = &$value[$key]; } $value = 1337; print_r($a); print_r($b);
Output for 4.3.0 - 7.1.0
Array ( [foo] => Array ( [bar] => 42 ) ) Array ( [foo] => Array ( [bar] => 1337 ) )