Check from Constructor if function in child class exists?

Posted by ArneRie on Stack Overflow See other posts from Stack Overflow or by ArneRie
Published on 2010-03-31T09:32:58Z Indexed on 2010/03/31 9:43 UTC
Read the original article Hit count: 302

Filed under:
|

Hi,

is it possible to do something like this in PHP 5.2.1?

abstract class Test
{
  public function __construct()
  {
     if (function_exists('init'):
        $this->init();
  }
}

If i try this, the function on the subclass is not called?

© Stack Overflow or respective owner

Related posts about php5

Related posts about oop