ultimix
array_functions.php File Reference

Go to the source code of this file.

Functions

 sort_by_field (&$Array, $Field)
 rsort_by_field (&$Array, $Field)

Function Documentation

rsort_by_field ( $Array,
  $Field 
)

Function sorts array.

Parameters
$Array- Array of entities.
$Field- Field name.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 71 of file array_functions.php.

{
usort(
$Array ,
create_function(
'$a , $b' ,
'return( get_field( $a , "'.$Field.'" ) > get_field( $b , "'.$Field.'" ) );'
)
);
}
sort_by_field ( $Array,
  $Field 
)

Function sorts array.

Parameters
$Array- Array of entities.
$Field- Field name.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 38 of file array_functions.php.

{
usort(
$Array ,
create_function(
'$a , $b' ,
'return( get_field( $a , "'.$Field.'" ) < get_field( $b , "'.$Field.'" ) );'
)
);
}