Checking if an overridden parent method exists before calling it

Posted by Nate Wagar on Stack Overflow See other posts from Stack Overflow or by Nate Wagar
Published on 2010-06-15T15:32:12Z Indexed on 2010/06/15 16:02 UTC
Read the original article Hit count: 158

Filed under:
|

How would I go about ensuring that the overridden parent method exists before I call it?
I've tried this:

public function func() {
    if (function_exists('parent::func')) {
        return parent::func();
    }
}

However the function_exists never evaluates to true.

© Stack Overflow or respective owner

Related posts about php

Related posts about php5