« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 74 for countable (0.002 sec.)
is_countable — 引数が、数えられる値かどうかを調べる | PHP 8.3 14783
is_countable (PHP 7 >= 7.3.0, PHP 8) is_countable — 引数が、数えられる値かどうかを調べる 説明 function is_countable ( mixed $value ): bool 引数の内容が、 array または Countable を実装したオブジェクトかどうかを調べます。 パラメータ value チェ ... ックする値 戻り値 value が数えられる場合に true 、 それ以外の場合に false を返します。 変更履歴 バージョン 説明 7.3.0 is_countable() が追加されました。 例 例1 is_countable() の例 <?php var_dump ( is_countable ([ 1 , 2 , 3 ])); // bool(true) var_dump ( i ... s_countable (new ArrayIterator ([ 'foo' , 'bar' , 'baz' ]))); // bool(true) var_dump ( is_countable (new ArrayIterator ())); // bool(t ... rue) var_dump ( is_countable (new stdClass ())); // bool(false) ?> 参考 is_array() - 変数が配列かどうかを検査する is_object() - 変数がオブジェクトかどう ...
https://man.mtool.work/php/8.3/function.is-countable.html
count — 配列または Countable | PHP 8.3 11912
count (PHP 4, PHP 5, PHP 7, PHP 8) count — 配列または Countable オブジェクトに含まれるすべての要素の数を数える 説明 function count ( Countable | array $value , int $mode = COUNT_NORMAL ): int 配列の場合は、配列の全ての要素を数えます。 Countable ... able インターフェイスを実装したオブジェクトの場合は、 Countable::count() の戻り値を返します。 パラメータ value 配列あるいは Countable オブジェクト。 mode オプションの mode 引数が COUNT_R ... 結果より大きい数を返します。 戻り値 value の要素の数を返します。 PHP 8.0.0 より前のバージョンでは、 パラメータが配列でもなく Countable インターフェイスを 実装したオブジェクトでもない場合、 1 が返されていました。 ただし、 value が null の場合、 0 が返されてい ... [ 0 ] = 7 ; $b [ 5 ] = 9 ; $b [ 10 ] = 11 ; var_dump ( count ( $b )); ?> 上の例の出力は以下となります。 int(3) int(3) 例2 Countable|array でない値を渡した場合の count() の例 (悪い例です - 真似しないでね!) <?php $b [ 0 ] = 7 ; $b [ 5 ] = 9 ; $b [ 10 ] = 1 ...
https://man.mtool.work/php/8.3/function.count.html
Countable::count — オブジェクトの要素の数を数える | PHP 8.3 11216
Countable::count (PHP 5 >= 5.1.0, PHP 7, PHP 8) Countable::count — オブジェクトの要素の数を数える 説明 public function Countable::count (): int このメソッドは、 count() 関数の value パラメータが Countable を実装している場合に実行されます。 ... パラメータ この関数にはパラメータはありません。 戻り値 数えたカスタムの結果を整数値として返します。 例 例1 Countable::count() の例 <?php class Counter implements Countable { private $count = 0 ; public function count (): int { return ++ $t ...
https://man.mtool.work/php/8.3/countable.count.html
Countable インターフェイス | PHP 8.3 10756
Countable インターフェイス (PHP 5 >= 5.1.0, PHP 7, PHP 8) はじめに Countable を実装したクラスは、 count() 関数で使用することができます。 インターフェイス概要 interface Countable { /* メソッド */ public function count (): int } 目次 Countable ...
https://man.mtool.work/php/8.3/class.countable.html
The Collection interface | PHP 8.3 8819
The Collection interface (PECL ds >= 1.0.0) はじめに Collection is the base interface which covers functionality common to all the data structures in this library. It guarantees that all structures are traversable, countable, and can be con ... verted to json using json_encode() . インターフェイス概要 interface Ds\Collection extends Countable , IteratorAggregate , JsonSerializable { /* メソッド */ public function clear (): void public function copy (): Ds\Collect ... ion public function isEmpty (): bool public function toArray (): array /* 継承したメソッド */ public function Countable::count (): int public function IteratorAggregate::getIterator (): Traversable public function JsonSerializable::jsonSerial ...
https://man.mtool.work/php/8.3/class.ds-collection.html
下位互換性のない変更点 | PHP 8.3 8359
下位互換性のない変更点 number_format() は負のゼロを返さない 以前のバージョンでは、 number_format() 関数が -0 を返せました。 これは IEEE 754 浮動小数点標準規格に沿ったまったく問題のない値ですが、 人間が読みやすい形式に数値をフォーマットすると ... するようになりました。 以前と同様の挙動を実現したい場合は、 null を渡すのではなく単にパラメータを省略するようにしましょう。 countable ではない型をカウントしたときの警告 countable ではない型に対して count() (およびそのエイリアスである sizeof() ) を使ったとき ... せん count ( 1 ), // integer はカウントできません count ( 'abc' ), // string はカウントできません count (new stdClass ), // Countable インターフェイスを実装していないオブジェクトはカウントできません count ([ 1 , 2 ]) // array はカウントできます ); 上の例の ... 出力は以下となります。 Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d Warn ...
https://man.mtool.work/php/8.3/migration72.incompatible.html
Imagick::count — 画像の数を取得する | PHP 8.3 7886
Imagick::count (PECL imagick 3 >= 3.3.0) Imagick::count — 画像の数を取得する 説明 public function Imagick::count ( int $mode = 0 ): int 画像の数を返します。 パラメータ mode 未使用の引数。現在、PHP には、countable オブジェクトに対して count( ... のメソッドがパラメータを受け取る必要がある (場合もない) という、あまり明確に定義されていない機能があります。このパラメータは countable インターフェイスに準拠するために存在しますが、パラメータ自体は使用されません。 戻り値 画像の数を返します。 ...
https://man.mtool.work/php/8.3/imagick.count.html
The SyncMutex class | PHP 8.3 7816
The SyncMutex class (PECL sync >= 1.0.0) はじめに A cross-platform, native implementation of named and unnamed countable mutex objects. A mutex is a mutual exclusion object that restricts access to a shared resource (e.g. a file) to a singl ... e instance. Countable mutexes acquire the mutex a single time and internally track the number of times the mutex is locked. The mutex is unlocke ...
https://man.mtool.work/php/8.3/class.syncmutex.html
DOMNodeList クラス | PHP 8.3 7509
DOMNodeList クラス (PHP 5, PHP 7, PHP 8) はじめに 現在のノードリストを表します。 クラス概要 class DOMNodeList implements IteratorAggregate , Countable { /* プロパティ */ public readonly int $ length ; /* メソッド */ public function count () ... NodeList は IteratorAggregate を実装しました。 これより前のバージョンでは、 Traversable を代わりに実装していました。 7.2.0 Countable インターフェイスが実装され、 length の値を返すようになりました。 注意 注意 : リスト中のノードは、配列の文法を使ってもアクセ ...
https://man.mtool.work/php/8.3/class.domnodelist.html
WeakMap クラス | PHP 8.3 7189
WeakMap クラス (PHP 8) はじめに WeakMap は、 オブジェクトをキーとして受け入れるマップ(辞書)です。 SplObjectStorage と似ていますが、 WeakMap のキーとなるオブジェクトは、 オブジェクトのリファレンスカウントが更新されません。 つまり、 WeakMap の ... ブジェクトから派生した、 データのキャッシュを作ることです。 WeakMap は ArrayAccess , Traversable ( IteratorAggregate 経由), Countable を実装しています。 よって、ほとんどのケースで、 連想配列と同じやり方で操作できます。 クラス概要 final class WeakMap implem ... ents ArrayAccess , Countable , IteratorAggregate { /* メソッド */ public function count (): int public function getIterator (): Iterator public functio ...
https://man.mtool.work/php/8.3/class.weakmap.html
PREV 1 2 3 4 5 6 7 8 NEXT