ultimix
array_functions.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
38  function sort_by_field( &$Array , $Field )
39  {
40  usort(
41  $Array ,
42  create_function(
43  '$a , $b' ,
44  'return( get_field( $a , "'.$Field.'" ) < get_field( $b , "'.$Field.'" ) );'
45  )
46  );
47  }
48 
71  function rsort_by_field( &$Array , $Field )
72  {
73  usort(
74  $Array ,
75  create_function(
76  '$a , $b' ,
77  'return( get_field( $a , "'.$Field.'" ) > get_field( $b , "'.$Field.'" ) );'
78  )
79  );
80  }
81 
82 ?>