Posted by Rafe Culpin on 09/30/60 11:41
In article <1141401380.714474.101750@v46g2000cwv.googlegroups.com>,
zeldorblat@gmail.com (ZeldorBlat) wrote:
> You can get to them using call_user_func() and constant() like this:
>
> class foo {
> const BAR = 5;
> public static function baz() {
> //do something static
> }
> }
>
> $myClassName = 'foo';
> $bar = constant($myClassName . '::BAR');
> $z = call_user_func(array($myClassName, 'baz'));
Aha! That works great - many thanks.
Seems odd they haven't made it simpler to do. Maybe in the next version.
--
To reply email rafe, at the address cix co uk
Navigation:
[Reply to this message]
|