Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 按索引值对数组排序(真、假)_Php_Arrays_Sorting - Fatal编程技术网

Php 按索引值对数组排序(真、假)

Php 按索引值对数组排序(真、假),php,arrays,sorting,Php,Arrays,Sorting,嗨,我希望我的数组首先根据'IsStart'真值进行排序 代码片段 [0] => Array ( [id] => 127 [name] => 23-3 [isStarted] => false [isAdmin] => ) [1] => Array ( [id] => 125 [name] => GameStartTest

嗨,我希望我的数组首先根据'IsStart'真值进行排序

代码片段

  [0] => Array
    (
        [id] => 127
        [name] => 23-3
        [isStarted] => false
        [isAdmin] => 
    )

[1] => Array
    (
        [id] => 125
        [name] => GameStartTesting
        [isStarted] => true
        [isAdmin] => 1
    )
我想先开始。试试这个

 usort ($array, function ($left, $right) {
        return $left['isStarted'] - $right['isStarted'];
    });