note 103955 modified in reflectionclass.getconstructor by danbrown
| From: | danbrown@php.net | Date: | Fri, 13 May 2011 15:14:55 +0000 |
| Subject: | note 103955 modified in reflectionclass.getconstructor by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179691@lists.php.net to get a copy of this message | ||
Old constructors also count as contructor:
<?php
class SomeClass {
function SomeClass($some_arg) {
}
}
$refl = new ReflectionClass('SomeClass');
var_dump($refl->isInstantiable()); // bool(true)
echo $refl->getConstructor();
/* OUTPUT:
Method [ <user, ctor> public method SomeClass ] {
@@ /var/www/vhosts/api.example.com/httpdocs/testRefl.php 5 - 6
- Parameters [1] {
Parameter #0 [ <required> $some_arg ]
}
}
*/
?>
Tested on PHP 5.2.4
--was--
Old (PHP 4) constructors also count as contructor:
<?php
class SomeClass {
function SomeClass($some_arg) {
}
}
$refl = new ReflectionClass('SomeClass');
var_dump($refl->isInstantiable()); // bool(true)
echo $refl->getConstructor();
/* OUTPUT:
Method [ <user, ctor> public method SomeClass ] {
@@ /var/www/vhosts/api.autoinkoop.nl/httpdocs/testRefl.php 5 - 6
- Parameters [1] {
Parameter #0 [ <required> $some_arg ]
}
}
*/
?>
Tested on PHP 5.2.4
http://php.net/manual/en/reflectionclass.getconstructor.php