PHPackages                             renzhifan/arr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. renzhifan/arr

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

renzhifan/arr
=============

常用的php数组方法

11PHP

Since Mar 15Pushed 5y agoCompare

[ Source](https://github.com/renzhifan/Arr)[ Packagist](https://packagist.org/packages/renzhifan/arr)[ RSS](/packages/renzhifan-arr/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)DependenciesVersions (1)Used By (0)

常用的 PHP 数组处理方法
==============

[](#常用的-php-数组处理方法)

安装组件
----

[](#安装组件)

```
composer require renzhifan/arr

```

功能介绍
----

[](#功能介绍)

### 对二维数组进行排序

[](#对二维数组进行排序)

```
$arr = [
        'a' => ['a' => 1],
        'b' => ['a' => 2],
        'c' => ['a' => 3],
        'd' => ['a' => 4],
    ];
 $sortArr=\Renzhifan\Arr\Arr::arraySort($arr, 'a', 'asc');
```

### 生成一段时间的默认数据

[](#生成一段时间的默认数据)

```
$timeRange=\Renzhifan\Arr\Arr::getTimeRange(20200121, 20200321, 'Y-m-d');
```

### 生成指定长度的随机字符串

[](#生成指定长度的随机字符串)

```
$randStr=\Renzhifan\Arr\Arr::getRandStr(9);
```

### 使用 mb\_\*系列函数实现反转中文字符串：

[](#使用-mb_系列函数实现反转中文字符串)

```
$reverseStr=\Renzhifan\Arr\Arr::reverseStr("你好啊");
```

### 求一个数组中出现最多的值

[](#求一个数组中出现最多的值)

```
$array = array(1, 1, 1, 54, 3, 4, 3, 4, 3, 14, 3, 4, 3, 7, 8, 9, 12, 45, 66, 5, 7, 8, 9, 2, 45, 3);
list($key, $count) = \Renzhifan\Arr\Arr::getMaxCountValue($array);
echo "数组中数字{$key}重复次数最多，为:{$count}次";
```

### 反转数组

[](#反转数组)

```
$arr = [11, 22, 33, 44, 55, 66, 77];

// 输出：[77,66,55,44,33,22,11]
echo json_encode(\Renzhifan\Arr\Arr::reverseArray($arr));
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ee0c317fe94bfeebc29c512bdf75ae5b65d5f3188fa2d42d3ce664da53e03d7?d=identicon)[renzhifan](/maintainers/renzhifan)

---

Top Contributors

[![renzhifan](https://avatars.githubusercontent.com/u/29975218?v=4)](https://github.com/renzhifan "renzhifan (10 commits)")

---

Tags

php

### Embed Badge

![Health badge](/badges/renzhifan-arr/health.svg)

```
[![Health](https://phpackages.com/badges/renzhifan-arr/health.svg)](https://phpackages.com/packages/renzhifan-arr)
```

###  Alternatives

[laracasts/utilities

Transform your PHP to JavaScript

2.2k10.0M39](/packages/laracasts-utilities)[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[spatie/server-side-rendering

Server side rendering JavaScript in your PHP application

631780.3k3](/packages/spatie-server-side-rendering)[fluidtypo3/flux

The flux package from FluidTYPO3

152982.2k20](/packages/fluidtypo3-flux)[dusterio/link-preview

Link preview generation for PHP with Laravel support

126326.6k3](/packages/dusterio-link-preview)[iamcal/lib_autolink

Adds anchors to urls in a text

631.3M3](/packages/iamcal-lib-autolink)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
