定制 vanderlee/php-stable-sort-functions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vanderlee/php-stable-sort-functions

最新稳定版本:2.0.6

Composer 安装命令:

composer require vanderlee/php-stable-sort-functions

包简介

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

README 文档

README

Version 2.0.6 Build Status

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

Introduction

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

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).

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.

Tests

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

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.

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

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

统计信息

  • 总下载量: 697.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 33
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 32
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固