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 class_exists Function

Published :
Author :
Adam Khoury
The class_exists() function is used to determine whether or not a class is defined in the script. It returns a boolean value of either TRUE or FALSE. demo.php <?php include_once("cart.php"); if(class_exists("cart")){ $shopping_cart = new cart(); echo $shopping_cart->store; } else { echo '"cart" class does not exist'; } ?> cart.php <?php class cart { public $store = "Spacely Sprockets"; public $items = array(); } ?>