Results of 1 - 10 of about 24 for iterable (0.002 sec.)
- is_iterable — 変数の内容が反復可能な値であることを確認する | PHP 8.3 14178
- is_iterable (PHP 7 >= 7.1.0, PHP 8) is_iterable — 変数の内容が反復可能な値であることを確認する 説明 function is_iterable ( mixed $value ): bool 変数の内容が iterable 疑似型で許容されること、すなわち array 、あるいは Traversable のどちらかを
... 確認する。 パラメータ value チェックする値 戻り値 value が反復可能であれば true を、そうでなければ false を返す。 例 例1 is_iterable() の例 <?php var_dump ( is_iterable ([ 1 , 2 , 3 ])); // bool(true) var_dump ( is_iterable (new ArrayIterator ([ 1 , 2 , 3 ... ]))); // bool(true) var_dump ( is_iterable ((function () { yield 1 ; })())); // bool(true) var_dump ( is_iterable ( 1 )); // bool(false) var_dump ( is_iterable (new ...
-
https://man.mtool.work/php/8.3/function.is-iterable.html
- ReflectionClass::isIterable — このクラスがイテレーション可能かを調べる | PHP 8.... 11659
- ReflectionClass::isIterable (PHP 7 >= 7.2.0, PHP 8) ReflectionClass::isIterable — このクラスがイテレーション可能かを調べる 説明 public function ReflectionClass::isIterable (): bool このクラスがイテレーション可能か(つまり、 foreach の内部で使
... スがイテレーション可能な場合は、 true を返します。 そうでない場合は、 false を返します。 例 例1 基本的な ReflectionClass::isIterable() の例 <?php class IteratorClass implements Iterator { public function __construct () {} public function key (): mixed {} ... ool {} public function rewind (): void {} } class DerivedClass extends IteratorClass {} class NonIterator {} function dump_iterable ( $class ) { $reflection = new ReflectionClass ( $class ); var_dump ( $reflection -> isIterable ()); } $classes = [ "Array ... Object" , "IteratorClass" , "DerivedClass" , "NonIterator" ,]; foreach ( $classes as $class ) { echo "Is $class iterable? " ; dump_iterable ( $class ); } ?> 上の例の出力は以下となります。 Is ArrayObject iterable? bool(true) Is IteratorClass it ...
-
https://man.mtool.work/php/8.3/reflectionclass.isiterable.html
- Iterable | PHP 8.3 11426
- Iterable Iterable は組み込みの、コンパイル時に変換される array|Traversable 型のエイリアスです。 この型は PHP 7.1.0 で導入されました。 PHP 8.2.0 より前のバージョンでは、 この型は上で述べた型のエイリアスとして振る舞う組み込みの疑似型でした。
... この型は、型宣言でも使うことができます。 iterable 型は、 foreach で繰り返し可能であり、 ジェネレータ 内で yield from できます。 注意 : 戻り値の型として iterable を宣言する関 ... 数は、 ジェネレータ にもなります。 例1 iterable を戻り値の型として使った、ジェネレータの例 <?php function gen (): iterable { yield 1 ; yield 2 ; yield 3 ; } foreach( gen ...
-
https://man.mtool.work/php/8.3/language.types.iterable.html
- その他の変更 | PHP 8.3 9140
- その他の変更 PHP コア iterable 型は、コンパイル時に組み込みで array | Traversable のエイリアスと見なされるようになりました。 よって、 iterable に関連するエラーメッセージは、 array|Traversable のものが使われるようになります。 型のリフレクショ
... ンは、単一の iterable (および ?iterable ) については iterable という名前が付いた ReflectionNamedType を生成しますが、 union 型の中で iterable を ... ローされていました。 Standard PHP Library(SPL) iterator_to_array() と iterator_count() の iterator 引数の型が Iterator から iterable に拡張され、 配列を渡せるようになりました。 拡張モジュールへのその他の変更 Date DatePeriod のプロパティが、適切に宣言される ...
-
https://man.mtool.work/php/8.3/migration82.other-changes.html
- 新機能 | PHP 8.3 8573
- 新機能 nullable な型 パラメータや戻り値の型宣言で nullable 指定ができるようになりました。 型の前にクエスチョンマークをつけると、nullable であることを指定できます。 nullable 指定をすると、指定した型だけでなく null も渡せるようになります。 <?
... _CONST_A = 1 ; public const PUBLIC_CONST_B = 2 ; protected const PROTECTED_CONST = 3 ; private const PRIVATE_CONST = 4 ; } iterable 擬似型 新しい擬似型 ( callable と同じような型) である iterable が導入されました。 パラメータおよび戻り値の型指定で使うこと ... ェクトを受け付けるようになります。 派生型に貸しては、子クラスのパラメータの型が、 親クラスの array や Traversable を拡張して iterable に広げることができます。 戻り値の型に関しては、親クラスの iterable 型指定を子クラスで 配列あるいはオブジェクト ( Traversab ... le を実装したもの) に絞り込むことができます。 <?php function iterator ( iterable $iter ) { foreach ( $iter as $val ) { // } } 例外処理における複数の例外の catch ひとつの catch ブロックで複数の例外を扱える ...
-
https://man.mtool.work/php/8.3/migration71.new-features.html
- foreach | PHP 8.3 8340
- foreach (PHP 4, PHP 5, PHP 7, PHP 8) foreach は、 配列とオブジェクトを反復処理する簡単な方法を提供します。 それらと異なるデータ型や、未初期化の変数と一緒に foreach を使うと、エラーが発生します。 foreach は、オプションで以下のようにして要素ご
... との key も取得できます。 foreach (iterable_expression as $value) { statement_list } foreach (iterable_expression as $key => $value) { statement_list } 最初の形式は、 ... iterable_expression で指定した値に 関してループ処理を行います。各反復において現在の要素の値が $value に代入されます。 2番目の形式は ... as & $value ) { $value = $value * 2 ; echo $value . "\n" ; } 上の例の出力は以下となります。 2 4 6 8 参考 array Traversable iterable list() 他のマニュアルの関連ページ Python controlflow Linux JM break(2) Python index Python compound_stmts DuckDB Indexing ...
-
https://man.mtool.work/php/8.3/control-structures.foreach.html
- pg_copy_from — 配列からテーブルに挿入する | PHP 8.3 8173
- pg_copy_from (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) pg_copy_from — 配列からテーブルに挿入する 説明 function pg_copy_from ( PgSql\Connection $connection , string $table_name , array | Traversable $rows , string $separator = "\t" , string $nul
... nnection PgSql\Connection クラスのインスタンス。 table_name rows をコピーするテーブルの名前。 rows table_name にコピーする iterable なデータ。 rows の個々の値が table_name のひとつの行となります。 rows の個々の値は、 それぞれのフィールドに対応する値が区切 ... \\\N" ) です。 戻り値 成功した場合に true を、失敗した場合に false を返します。 変更履歴 バージョン 説明 8.5.0 rows の型が iterable になりました。 以前は、 array でした。 8.1.0 connection は、 PgSql\Connection クラスのインスタンスを期待するようになりまし ...
-
https://man.mtool.work/php/8.3/function.pg-copy-from.html
- 型 | PHP 8.3 8006
- 型 目次 はじめに 型システム NULL 論理型 (boolean) 整数 浮動小数点数 文字列 数値形式の文字列 配列 オブジェクト 列挙型 / Enum リソース コールバック / Callable Mixed Void Never クラス内での関係を示す相対型 シングルトン型 Iterable 型宣言 型の相
...
-
https://man.mtool.work/php/8.3/language.types.html
- 新しい関数 | PHP 8.3 8006
- 新しい関数 PHP コア sapi_windows_cp_get() sapi_windows_cp_set() sapi_windows_cp_conv() sapi_windows_cp_is_utf8() Closure Closure::fromCallable() CURL curl_multi_errno() curl_share_errno() curl_share_strerror() OpenSSL openssl_get_curve_name
... s() Session session_create_id() session_gc() SPL is_iterable() PCNTL pcntl_async_signals() pcntl_signal_get_handler() 他のマニュアルの関連ページ DuckDB Encodings Extension DuckDB Duck ...
-
https://man.mtool.work/php/8.3/migration71.new-functions.html
- その他の予約語の一覧 | PHP 8.3 7839
- その他の予約語の一覧 これらの名前は、クラスやインターフェイス、トレイト、そして列挙型の名前として使えません。 PHP 8.0 より前のバージョンでは、名前空間の中であっても使えませんでした。 予約語 parent self int float bool string true false null
... void (PHP 7.1 以降) iterable (PHP 7.1 以降) object (PHP 7.2 以降) mixed (PHP 8.0 以降) never (PHP 8.1 以降) array (PHP 8.5 以降) callable (PHP 8.5 以降 ...
-
https://man.mtool.work/php/8.3/reserved.other-reserved-words.html