Coder Social home page Coder Social logo

folliked / php-stable-sort-functions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vanderlee/php-stable-sort-functions

0.0 2.0 0.0 99 KB

Stable sort variants of builtin PHP sort functions. These maintain original order if comparison values are equal.

PHP 100.00%

php-stable-sort-functions's Introduction

PHP stable sort functions

Version 1.0.1 Build Status

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

Introduction

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

These sort functions follow the same interface and have the same functionality and features as the builtin sort functions (except they add guaranteed sort order). They have an "s" prefixed to the function name.

Each function has it's own file. Since you're likely to want to only include the specific function(s) you need, this makes it easier. Just copy & paste.

Functions

  • bool sarsort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
  • bool sasort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
  • bool snatcasesort ( array &Sarray )
  • bool snatsort ( array &Sarray )
  • bool suasort ( array &$array , callable $value_compare_func )
  • bool suksort ( array &$array , callable $value_compare_func )
  • bool susort ( array &$array , callable $value_compare_func )

Tests

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

Disclaimers

Only functions that make sense 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.

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

Changes

1.0.1

  • composer.json added by @thebeline.

1.0

  • Initial public release

php-stable-sort-functions's People

Contributors

folliked avatar thebeline avatar vanderlee avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.