Calling a static method on a class known by name?

Posted by Palantir on Stack Overflow See other posts from Stack Overflow or by Palantir
Published on 2010-06-09T09:57:42Z Indexed on 2010/06/09 11:12 UTC
Read the original article Hit count: 162

Filed under:

Hello!

Is there any way to obtain this effect in a PHP version prior to 5.3?

class A {
  public static function x() {print 'ok'; }
}

$className = 'A';
$className::x();

Thanks! Palantir

© Stack Overflow or respective owner

Calling a static method on a class known by name?

Posted by Palantir on Stack Overflow See other posts from Stack Overflow or by Palantir
Published on 2010-06-09T09:29:54Z Indexed on 2010/06/09 9:32 UTC
Read the original article Hit count: 162

Filed under:

Hello!

Is there any way to obtain this effect in a PHP version prior to 5.3?

$className = 'A';
$className::myStaticMethod();

Thanks! Palantir

© Stack Overflow or respective owner

Related posts about php