We can create a new instances of ArrayObject passing an array as constructor parameter
$arrayObject = new ArrayObject([1,2,3]);
but that is also fine:
$arrayObject = new ArrayObject();
However
$arrayObjectReflection = new ReflectionClass('ArrayObject');
$arrayObjectReflection->getConstructor()->getNumberOfRequiredParameters();
Returns 1.
Am I misunderstand optional parameters in PHP or that is just a bug?
P.S: I'm using PHP 5.5.9 (Zend Engine)
Aucun commentaire:
Enregistrer un commentaire