protected function sortByArray($array, $order)
    {
        $keys = array_keys($array);
        
        return array_merge(
            array_flip(
                array_intersect($order, $keys) +
                array_diff($keys, $order)
            ),
            $array
        );
    }
protected function sortByArray($array, $order)
    {
        $keys = array_keys($array);
        
        return array_merge(
            array_flip(
                array_intersect($order, $keys) +
                array_diff($keys, $order)
            ),
            $array
        );
    }
protected function sortByArray ( $ array , $ order ) { $ keys = array_keys ( $ array ) ; return array_merge ( array_flip ( array_intersect ( $ order , $ keys ) + array_diff ( $ keys , $ order ) ) , $ array ) ; }
Sort an array by its keys, using a given array as the sort order.

@param  array  $array
@param  array  $order
@return array
Sort an array by its keys using a given array as the sort order .