Hi people! Since I couldnt get answers from Stackoverflow I desiced to ask you.
Can someone explain how does these 2 functions work:
class_exists()
spl_autoload_register()
Class exist function
if(class_exists('User')){
echo "It does exists";
}
class User {
/*
Some code here
*/
}
// the output of file is "It does exists"
So how does this function works? Scans whole file? Whole directory? I mean its called before I defined class.
Spl autoload register function
include 'functions.php'; // <- file where is the function class_exist('User') and spl_autoload_register()
include 'db_config.php';
include 'database.php';
include 'user.php'; // <- Here is the class (User)
So how does this function work? Its before any of those files that are included, and still it does it work? Does it scans whole directory where it is or what? I am really confused.
Thanks peeps!