using Zend_Loader::loadClass and include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

using Zend_Loader::loadClass and include

Post by dude81 »

whats difference will it make while using Zend_Loader::loadClass and include_once or require_once.
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

Zend_Loader::LoadClass will find a file based on a class name and load it

For instance if you have a class named MY_Class_Name load class will search for a file in your path (or paths you specify in the function call) in a subdirecty based on the class name like: MY/Class/Name.php and include that file. If the class has already been declared then it won't try to include the file.


Require_once and include_once are used to include arbitrary files, nothing more. Using those functions you have to specify the file name instead of a class name.
Post Reply