|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-24 21:27 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ An equivalent to ReflectionMethod::invokeArgs() is missing for creating new instances of classes through the Reflection API where the class' constructor requires parameters. I there propose ReflectionClass::newInstanceArgs($args) in addition to the existing ReflectionClass::newInstance() method. Reproduce code: --------------- <?php class Sample { public function __construct($a, $b) { print "$a, $b"; } } $class = new ReflectionClass('Sample'); $object = $class->newInstanceArgs(array(23, 42)); ?> Expected result: ---------------- 23, 42