3v4l.org

run code in 300+ PHP versions simultaneously
<?php $assoc_arr = array("second" => array( array("position" => 4, "content" => "Valiant"), array("position" => 5, "content" => "Hail") ), "first" => array( array("position" => 0, "content" => "Hail"), array("position" => 3, "content" => "Victors"), array("position" => 2, "content" => "the"), array("position" => 1, "content" => "to") ) ); $order = array('first','second'); $arr = array(); foreach($order as $ord) { if(isset($assoc_arr[$ord]) $arr = array_merge($arr, $assoc_arr[$ord]); } print_r($arr);
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected '$arr' (T_VARIABLE) in /in/T3Bv1 on line 26
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/T3Bv1 on line 26
Process exited with code 255.

preferences:
168.95 ms | 1394 KiB | 64 Q