Say,$arr contains multiple sub-arrays with the key "pos",
$arr = sortByKey($arr,'pos');
After that the sub-array with smallest "pos" value will be ordered first,and so on.
EDIT
$sub1 = array('pos' => 2);
$sub2 = array('pos' => 1);
$arr = array($sub1,$sub2);
$arr = sortByKey($arr,'pos');
After this function,$arr will be array($sub2,$sub1)