update page now

ReflectionClass::newInstance

(PHP 5, PHP 7, PHP 8)

ReflectionClass::newInstance指定した引数でクラスの新しいインスタンスを作成する

説明

public ReflectionClass::newInstance(mixed ...$args): object

クラスの新しいインスタンスを作成します。指定した引数をクラスのコンストラクタに渡します。

パラメータ

args

可変長の引数を受け付け、それを call_user_func() と同じ方式でクラスのコンストラクタに渡します。

戻り値

エラー / 例外

コンストラクタが public でない場合は ReflectionException が発生します。

クラスにコンストラクタがないときに args を指定すると ReflectionException が発生します。

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant