uasort($data,create_function('$a,$b','$skeys = split(\',\',\''.$sortby.'\'); foreach($skeys as $key){ if( ($c = strcasecmp($a[$key],$b[$key])) != 0 ){ return($c); } } return($c); '));}Notice that I am splitting the string in the comparison function? While this is certainly slower, it was the only way I would find to "pass" and "array". If anyone has a better way, please suggest. Then inside, we (string) compare the values only moving to the next key if the values are the same...and so on, and so on.