Results of 1 - 1 of about 1 for Adam (0.000 sec.)
- usort — ユーザー定義の比較関数を使用して、配列を値でソートする | PHP 8.3 9414
- usort (PHP 4, PHP 5, PHP 7, PHP 8) usort — ユーザー定義の比較関数を使用して、配列を値でソートする 説明 function usort ( array &$array , callable $callback ): true 順序を決めるユーザー定義の比較関数により、 array をその値でソートします。 注意
... $people を last name で比較し、 それが一致するものについては first name で比較します。 <?php $people [ 0 ] = [ 'first' => 'Adam' , 'last' => 'West' ]; $people [ 1 ] = [ 'first' => 'Alec' , 'last' => 'Baldwin' ]; $people [ 2 ] = [ 'first' => 'Adam' , ... $person ) { print $person [ 'last' ] . ', ' . $person [ 'first' ] . PHP_EOL ; } ?> 上の例の出力は以下となります。 Baldwin, Adam Baldwin, Alec West, Adam 参考 uasort() - ユーザー定義の比較関数で配列をソートし、連想インデックスを保持する uksort() - ユー ...
-
https://man.mtool.work/php/8.3/function.usort.html
PREV
1
NEXT