array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'reflectionclass.newinstance.php', 1 => 'ReflectionClass::newInstance', ), 'up' => array ( 0 => 'class.reflectionclass.php', 1 => 'ReflectionClass', ), 'prev' => array ( 0 => 'reflectionclass.isuserdefined.php', 1 => 'ReflectionClass::isUserDefined', ), 'next' => array ( 0 => 'reflectionclass.newinstanceargs.php', 1 => 'ReflectionClass::newInstanceArgs', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/reflection/reflectionclass/newinstance.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
ReflectionClass::newInstance — 指定した引数でクラスの新しいインスタンスを作成する
クラスの新しいインスタンスを作成します。指定した引数をクラスのコンストラクタに渡します。
コンストラクタが public でない場合は ReflectionException が発生します。
クラスにコンストラクタがないときに args
を指定すると
ReflectionException が発生します。