2017 © Pedro Peláez
 

library php-stable-sort-functions

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

image

vanderlee/php-stable-sort-functions

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

  • Saturday, June 30, 2018
  • by vanderlee
  • Repository
  • 2 Watchers
  • 20 Stars
  • 82,455 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 8 Versions
  • 12 % Grown

The README.md

PHP stable sort

Version 2.0.6 Build Status, (*1)

Copyright © 2015-2018 Martijn van der Lee (http://martijn.vanderlee.com). MIT Open Source license applies., (*2)

Introduction

Class of stable sort utility methods and standalone functions. Equal values remain in the original order. Only different values are sorted., (*3)

These sort utility methods follow the same interface and have the same functionality and features as the builtin sort utility methods (except they add guaranteed sort order)., (*4)

Static methods

  • bool StableSort::arsort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
  • bool StableSort::asort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
  • bool StableSort::natcasesort ( array &Sarray )
  • bool StableSort::natsort ( array &Sarray )
  • bool StableSort::uasort ( array &$array , callable $value_compare_func )
  • bool StableSort::uksort ( array &$array , callable $value_compare_func )
  • bool StableSort::usort ( array &$array , callable $value_compare_func )

For backwards compatibility, functions (prefixed with s) are available that utilize the utility class., (*5)

Tests

PHPUnitTest testcases are included (group stablesort) in the tests directory., (*6)

Disclaimers

Only methods that make sense for stable sorting are included, so no sort or ksort variants. If you can demonstrate the case for any missing function, please let me know and they will be included., (*7)

These are not the fastest possible implementations. In fact, I guarantee they are not. Performance has been sacrificed for compatibility with their builtin counterparts., (*8)

Changes

2.0.6

  • PHP 8 sorts stable by default. Use native methods if PHP 8 or more recent.

2.0.1

  • Merge @joelpittet 2.0.0 into main branch, cleaning Drupal specifics.

2.0.0

  • Converted to Utility class. By @joelpittet

1.0.3

  • Added reset calls to sasort/sarsort to ensure pointer. By @emilv.

1.0.2

  • PHP 5.3 compatibility changes by @folliked.

1.0.1

  • composer.json added by @thebeline.

1.0

  • Initial public release

The Versions

30/06 2018

dev-master

9999999-dev https://github.com/vanderlee/PHP-stable-sort-functions

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

30/06 2018

2.0.4

2.0.4.0 https://github.com/vanderlee/PHP-stable-sort-functions

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

21/12 2016

2.0.3

2.0.3.0 https://github.com/vanderlee/PHP-stable-sort-functions

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

15/01 2016

2.0.2

2.0.2.0 https://github.com/vanderlee/PHP-stable-sort-functions

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

10/01 2016

2.0.1

2.0.1.0 https://github.com/vanderlee/PHP-stable-sort

Class of stable sort methods. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

08/09 2015

1.0.3

1.0.3.0 https://github.com/vanderlee/PHP-stable-sort-functions

Collection of sort functions using stable sort. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

27/07 2015

1.0.2

1.0.2.0 https://github.com/vanderlee/PHP-stable-sort-functions

Collection of sort functions using stable sort. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort

10/06 2015

1.0.1

1.0.1.0 https://github.com/vanderlee/PHP-stable-sort-functions

Collection of sort functions using stable sort. Equal values remain in the original order. Only different values are sorted.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array sort stable usort arsort asort natcasesort natsort uasort uksort