3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $somearray = array( 'item1' => array( 'subitem1' => 'Some value', 'subitem2' => 'Some other value' 'subitem3' => array( 'subsubitem' => 'A sub value' ) ), 'item2' => 'a different value' ); $map = "item1/subitem3/subsubitem"; $parts = explode("/", $map); $currentData = $somearray; for ($i = 0; $i < count($parts); $i++) { $currentData = $currentData[$parts[$i]]; } $result = $currentData; echo $result;
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected ''subitem3'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /in/9CBoN on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /in/9CBoN on line 7
Process exited with code 255.