« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 32 for ksort (0.001 sec.)
Ds\Map::ksort — Sorts the map in-place by key | PHP 8.3 13596
Ds\Map::ksort (PECL ds >= 1.0.0) Ds\Map::ksort — Sorts the map in-place by key 説明 public function Ds\Map::ksort ( callable $comparator = ? ): void Sorts the map in-place by key, using an optional comparator function. パラメータ comparator ... つまり、 0.99 や 0.1 といった値は整数値 0 にキャストされ、 値が等しいとみなされます。 戻り値 値を返しません。 例 例1 Ds\Map::ksort() example <?php $map = new \Ds\Map ([ "b" => 2 , "c" => 3 , "a" => 1 ]); $map -> ksort (); print_r ( $map ); ?> 上の例の出 ... ] => 1 ) [1] => Ds\Pair Object ( [key] => b [value] => 2 ) [2] => Ds\Pair Object ( [key] => c [value] => 3 ) ) 例2 Ds\Map::ksort() example using a comparator <?php $map = new \Ds\Map ([ 1 => "x" , 2 => "y" , 0 => "z" ]); // Reverse $map -> ksort (func ...
https://man.mtool.work/php/8.3/ds-map.ksort.html
ksort — 配列をキーで昇順にソートする | PHP 8.3 12404
ksort (PHP 4, PHP 5, PHP 7, PHP 8) ksort — 配列をキーで昇順にソートする 説明 function ksort ( array &$array , int $flags = SORT_REGULAR ): true array をキーで昇順にソートします。 注意 : 比較結果が等しくなる二つの要素があった場合、それらの並 ... .2.0 SORT_REGULAR を使って数値形式の文字列の比較を行う際に、 PHP 8 で標準になっているルールを使うようになりました。 例 例1 ksort() の例 <?php $fruits = array( "d" => "lemon" , "a" => "orange" , "b" => "banana" , "c" => "apple" ); ksort ( $fruits ); fo ... o " $key = $val \n" ; } ?> 上の例の出力は以下となります。 a = orange b = banana c = apple d = lemon 例2 数値がキーの場合の ksort() の振る舞い <?php $a = [ 0 => 'First' , 2 => 'Last' , 1 => 'Middle' ]; var_dump ( $a ); ksort ( $a ); var_dump ( $a ); ?> ...
https://man.mtool.work/php/8.3/function.ksort.html
ArrayObject::ksort — キーでエントリをソートする | PHP 8.3 11760
ArrayObject::ksort (PHP 5 >= 5.2.0, PHP 7, PHP 8) ArrayObject::ksort — キーでエントリをソートする 説明 public function ArrayObject::ksort ( int $flags = SORT_REGULAR ): true キーでエントリをソートし、キーと値の関係は保持します。 主に連想配列 ... 履歴 バージョン 説明 8.2.0 戻り値の型が、 true になりました。これより前のバージョンでは、 bool でした。 例 例1 ArrayObject::ksort() の例 <?php $fruits = array( "d" => "lemon" , "a" => "orange" , "b" => "banana" , "c" => "apple" ); $fruitArrayObject = n ... ew ArrayObject ( $fruits ); $fruitArrayObject -> ksort (); foreach ( $fruitArrayObject as $key => $val ) { echo " $key = $val \n" ; } ?> 上の例の出力は以下となります。 a = orang ... ントリをソートする ArrayObject::uasort() - ユーザー定義の比較関数でエントリをソートし、キーとの対応は保持する ArrayObject::uksort() - ユーザー定義の比較関数を使って、キーでエントリをソートする ksort() - 配列をキーで昇順にソートする 他のマニュアルの関連 ...
https://man.mtool.work/php/8.3/arrayobject.ksort.html
ArrayIterator::ksort — キーで配列をソートする | PHP 8.3 10245
ArrayIterator::ksort (PHP 5 >= 5.2.0, PHP 7, PHP 8) ArrayIterator::ksort — キーで配列をソートする 説明 public function ArrayIterator::ksort ( int $flags = SORT_REGULAR ): true キーで配列をソートします。 注意 : 比較結果が等しくなる二つの要素 ... トする ArrayIterator::uasort() - ユーザー定義の比較関数を使ってソートを行い、インデックスとの関連を管理する ArrayIterator::uksort() - ユーザー定義の比較関数を使い、キーでソートする ksort() - 配列をキーで昇順にソートする 他のマニュアルの関連ページ Linux ...
https://man.mtool.work/php/8.3/arrayiterator.ksort.html
preg_replace — 正規表現検索および置換を行う | PHP 8.3 8634
preg_replace (PHP 4, PHP 5, PHP 7, PHP 8) preg_replace — 正規表現検索および置換を行う 説明 function preg_replace ( string | array $pattern , string | array $replacement , string | array $subject , int $limit = -1 , int &$count = null ): str ... ents , $string ); ?> 上の例の出力は以下となります。 The bear black slow jumps over the lazy dog. pattern と replacement を ksort すると、所望のものが得られます。 <?php $string = 'The quick brown fox jumps over the lazy dog.' ; $patterns = array(); $pa ... ' ; $replacements = array(); $replacements [ 2 ] = 'bear' ; $replacements [ 1 ] = 'black' ; $replacements [ 0 ] = 'slow' ; ksort ( $patterns ); ksort ( $replacements ); echo preg_replace ( $patterns , $replacements , $string ); ?> 上の例の出力は以下と ... て、どの pattern が、どの replacement に置換されるかを指定しようとする場合は、 preg_replace() をコールする前に、各配列に対し ksort() を実行しておくべきです。 注意 : pattern と replacement が両方配列の場合、 ルールのマッチは順番に行われます。 つまり、 二 ...
https://man.mtool.work/php/8.3/function.preg-replace.html
配列のソート | PHP 8.3 8312
配列のソート PHP には配列をソートする関数が複数用意されています。 このページでは、それらの違いについて説明します。 主な相違点は次のとおりです。 配列のキーでソートするものと、値でソートするものがあります。 $array['キー'] = '値'; キーと値の相 ... ートオプション array_walk() asort() 値 維持する 昇順 arsort() arsort() 値 維持する 降順 asort() krsort() キー 維持する 降順 ksort() ksort() キー 維持する 昇順 krsort() natcasesort() 値 維持する 大文字小文字を区別しない自然順 natsort() natsort() 値 維持 ... sort() shuffle() 値 維持しない ランダム array_rand() sort() 値 維持しない 昇順 rsort() uasort() 値 維持する ユーザー定義 uksort() uksort() キー 維持する ユーザー定義 uasort() usort() 値 維持しない ユーザー定義 uasort() 他のマニュアルの関連ページ Linu ...
https://man.mtool.work/php/8.3/array.sorting.html
ArrayIterator クラス | PHP 8.3 8087
ArrayIterator クラス (PHP 5, PHP 7, PHP 8) はじめに このイテレータは、配列やオブジェクトを反復処理する際に 値やキーを修正したり、要素を削除することができます。 同じ配列を何度も反復処理したい場合は、 ArrayObject をインスタンス化し、 内部に保 ... nction getArrayCopy (): array public function getFlags (): int public function key (): string | int | null public function ksort ( int $flags = SORT_REGULAR ): true public function natcasesort (): true public function natsort (): true public function ... string public function setFlags ( int $flags ): void public function uasort ( callable $callback ): true public function uksort ( callable $callback ): true public function unserialize ( string $data ): void public function valid (): bool } 定義済み定 ... ピーを取得する ArrayIterator::getFlags — 振る舞いのフラグを取得する ArrayIterator::key — 現在の配列キーを返す ArrayIterator::ksort — キーで配列をソートする ArrayIterator::natcasesort — 大文字小文字を区別せずに自然順で配列をソートする ArrayIterator::nats ...
https://man.mtool.work/php/8.3/class.arrayiterator.html
ImagickKernel::fromBuiltIn — 組み込みカーネルからカーネルを作成する | PHP 8.3 8087
ImagickKernel::fromBuiltIn (PECL imagick >= 3.3.0) ImagickKernel::fromBuiltIn — 組み込みカーネルからカーネルを作成する 説明 public static function ImagickKernel::fromBuiltin ( int $kernelType , string $kernelString ): ImagickKernel 組み込み ... gickDraw -> setStrokeColor ( 'none' ); $imagickDraw -> translate ( $imageMargin , $imageMargin ); $imagickDraw -> push (); ksort ( $matrix ); foreach ( $matrix as $row ) { ksort ( $row ); $imagickDraw -> push (); foreach ( $row as $cell ) { if ( $cell ...
https://man.mtool.work/php/8.3/imagickkernel.frombuiltin.html
ArrayObject クラス | PHP 8.3 7990
ArrayObject クラス (PHP 5, PHP 7, PHP 8) はじめに このクラスは、オブジェクトを配列として動作させます。 注意 : このクラスでオブジェクトをラップして使うことは、基本的に間違いです。 そのため、オブジェクトと一緒に使うべきではありません。 クラス ... tion getFlags (): int public function getIterator (): Iterator public function getIteratorClass (): string public function ksort ( int $flags = SORT_REGULAR ): true public function natcasesort (): true public function natsort (): true public function ... tion setIteratorClass ( string $iteratorClass ): void public function uasort ( callable $callback ): true public function uksort ( callable $callback ): true public function unserialize ( string $data ): void } 定義済み定数 ArrayObject の定数 ArrayObj ... スタンスから新規イテレータを生成する ArrayObject::getIteratorClass — ArrayObject のイテレータクラス名を取得する ArrayObject::ksort — キーでエントリをソートする ArrayObject::natcasesort — 大文字小文字を区別しない "自然順" アルゴリズムでエントリをソートす ...
https://man.mtool.work/php/8.3/class.arrayobject.html
The Map class | PHP 8.3 7990
The Map class (PECL ds >= 1.0.0) はじめに A Map is a sequential collection of key-value pairs, almost identical to an array used in a similar context. Keys can be any type, but must be unique. Values are replaced if added to the map using t ... unction intersect ( Ds\Map $map ): Ds\Map public function isEmpty (): bool public function keys (): Ds\Set public function ksort ( callable $comparator = ? ): void public function ksorted ( callable $comparator = ? ): Ds\Map public function last (): D ... nSerialize — Returns a representation that can be converted to JSON Ds\Map::keys — Returns a set of the map's keys Ds\Map::ksort — Sorts the map in-place by key Ds\Map::ksorted — Returns a copy, sorted by key Ds\Map::last — Returns the last pair of th ...
https://man.mtool.work/php/8.3/class.ds-map.html
PREV 1 2 3 4 NEXT