note 95548 added to function.get-class-methods
| From: | fschmengler at sgh-it dot eu | Date: | Fri, 08 Jan 2010 12:40:16 +0000 |
| Subject: | note 95548 added to function.get-class-methods | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164779@lists.php.net to get a copy of this message | ||
It should be noted that the returned methods are dependant on the current scope. See this example:
<?php
class C
{
private function privateMethod()
{
}
public function publicMethod()
{
}
public function __construct()
{
echo '$this:';
var_dump(get_class_methods($this));
echo 'C (inside class):';
var_dump(get_class_methods('C'));
}
}
$c = new C;
echo '$c:';
var_dump(get_class_methods($c));
echo 'C (outside class):';
var_dump(get_class_methods('C'));
?>
Output:
$this:
array
0 => string 'privateMethod' (length=13)
1 => string 'publicMethod' (length=12)
2 => string '__construct' (length=11)
C (inside class):
array
0 => string 'privateMethod' (length=13)
1 => string 'publicMethod' (length=12)
2 => string '__construct' (length=11)
$c:
array
0 => string 'publicMethod' (length=12)
1 => string '__construct' (length=11)
C (outside class):
array
0 => string 'publicMethod' (length=12)
1 => string '__construct' (length=11)
----
Server IP: 212.124.37.9
Probable Submitter: 217.235.237.167
----
Manual Page -- http://www.php.net/manual/en/function.get-class-methods.php
Edit -- https://master.php.net/note/edit/95548
Del: integrated -- https://master.php.net/note/delete/95548/integrated
Del: useless -- https://master.php.net/note/delete/95548/useless
Del: bad code -- https://master.php.net/note/delete/95548/bad+code
Del: spam -- https://master.php.net/note/delete/95548/spam
Del: non-english -- https://master.php.net/note/delete/95548/non-english
Del: in docs -- https://master.php.net/note/delete/95548/in+docs
Del: other reasons-- https://master.php.net/note/delete/95548
Reject -- https://master.php.net/note/reject/95548
Search -- https://master.php.net/manage/user-notes.php