original_string: public static function sortArrayByKey($array, $array_key, $direction = SORT_DESC, $sort_flags = SORT_REGULAR)
      {
          $output = [];
  
          if (!is_array($array) || !$array) {
              return $output;
          }
  
          foreach ($array as $key => $row) {
              $output[$key] = $row[$array_key];
          }
  
          array_multisort($output, $direction, $sort_flags, $array);
  
          return $array;
      }
code: public static function sortArrayByKey($array, $array_key, $direction = SORT_DESC, $sort_flags = SORT_REGULAR)
      {
          $output = [];
  
          if (!is_array($array) || !$array) {
              return $output;
          }
  
          foreach ($array as $key => $row) {
              $output[$key] = $row[$array_key];
          }
  
          array_multisort($output, $direction, $sort_flags, $array);
  
          return $array;
      }
code_tokens: public static function sortArrayByKey ( $ array , $ array_key , $ direction = SORT_DESC , $ sort_flags = SORT_REGULAR ) { $ output = [ ] ; if ( ! is_array ( $ array ) || ! $ array ) { return $ output ; } foreach ( $ array as $ key => $ row ) { $ output [ $ key ] = $ row [ $ array_key ] ; } array_multisort ( $ output , $ direction , $ sort_flags , $ array ) ; return $ array ; }
docstring: Sort an array by a key value in the array
  
  @param mixed $array
  @param string|int $array_key
  @param int $direction
  @param int $sort_flags
  @return array
docstring_tokens: Sort an array by a key value in the array