2017 © Pedro Peláez
 

library array_order_by

A PHP function to database-style order an array.

image

yurybykov/array_order_by

A PHP function to database-style order an array.

  • Saturday, July 22, 2017
  • by yurybykov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 47 % Grown

The README.md

array_order_by

A PHP function to database-style order an array. I am not author of original function, it was taken from http://php.net/manual/ru/function.array-multisort.php, (*1)

Install

Normal install via Composer., (*2)

Usage

Throw any array or object with the coordinates of the field you want to sort by:, (*3)

$data = [];
$data[] = array('volume' => 67, 'edition' => 2);
$data[] = array('volume' => 86, 'edition' => 1);
$data[] = array('volume' => 85, 'edition' => 6);
$data[] = array('volume' => 98, 'edition' => 2);
$data[] = array('volume' => 86, 'edition' => 6);
$data[] = array('volume' => 67, 'edition' => 7);

// Pass the array, followed by the column names and sort flags
$sorted = array_order_by($data, 'volume', SORT_DESC, 'edition', SORT_ASC);

The Versions

22/07 2017

v1.2.0

1.2.0.0 https://github.com/yurybykov/php_array_order_by

A PHP function to database-style order an array.

  Sources   Download

Unlicense

The Requires

  • php >=5.3.0

 

by Jimpoz
by Yury Bykov

php array order

22/07 2017

dev-master

9999999-dev https://github.com/yurybykov/php_array_orderby

A PHP function to database-style order an array.

  Sources   Download

Unlicense

The Requires

  • php >=5.3.0

 

by Jimpoz
by Yury Bykov

php array order

22/07 2017

v1.1.0

1.1.0.0 https://github.com/yurybykov/php_array_orderby

A PHP function to database-style order an array.

  Sources   Download

Unlicense

The Requires

  • php >=5.3.0

 

by Jimpoz
by Yury Bykov

php array order

11/05 2017

v1.0.0

1.0.0.0 https://github.com/yurybykov/php_array_orderby

A PHP function to database-style order an array.

  Sources   Download

Unlicense

The Requires

  • php >=5.3.0

 

by Jimpoz
by Yury Bykov

php array order