FULL STACK   ·   UI   ·   UX   ·   GRAPHICS   ·   DEVELOPER   ·   INSTRUCTOR

Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Using the method_exists Function

Published :
Author :
Adam Khoury
The method_exists() function will evaluate to see if the specified method exists. It returns TRUE if the method is found and FALSE if it is not. demo.php <?php include_once("class1.php"); $myObj = new class1(); if(method_exists($myObj, "sayhello")){ echo $myObj->sayhello(); } else { echo "sayhello method does not exist"; } ?> class1.php <?php class class1 { public function sayhello(){ return "Hello"; } } ?>