3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr1 = array("foo", "ybar", "baz"); $arr2 = array("foo2", "ybar2", "baz2"); $arr3 = array("foo3", "ybar3", "baz3"); $results = array(); foreach ($arr1 as $key=>$value) { $results[] = array( 'arr1' => $value, 'arr2' => $arr2[$key], 'arr3' => $arr3[$key], ); } function sortByArr1($a, $b) { return strcmp($a['arr1'], $b['arr1']); } usort($results, "sortByArr1"); print "<pre>"; print_r($results);
Output for 4.3.0 - 7.1.0
<pre>Array ( [0] => Array ( [arr1] => baz [arr2] => baz2 [arr3] => baz3 ) [1] => Array ( [arr1] => foo [arr2] => foo2 [arr3] => foo3 ) [2] => Array ( [arr1] => ybar [arr2] => ybar2 [arr3] => ybar3 ) )