Jump to content
Killersites Community
Biske94

How does these functions work?

Recommended Posts

Hi people! Since I couldnt get answers from Stackoverflow I desiced to ask you.

Can someone explain how does these 2 functions work:

  1. class_exists()
  2. 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!

Share this post


Link to post
Share on other sites
Guest Joseppi83

Similar to the following line in connected css files:

 

@import "services.css";

@import "blog-section.css";

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×