Search code examples
phpsmarty

How to check valid object of class in smarty?


Is there any function in smarty to check valid object of class in smarty?

Suppose $obj is having some value or not.

How to check $obj is object of 'TestClass' or not in smarty?


Solution

  • This is the way to check variable is object of specific class in Smarty.

    if( true eq isset($obj) && true eq is_object($obj) && $obj instanceof 'TestClass' ){
    //do something
    }