TBDev.NET
Navigation
Home
Articles
Downloads
FAQ
Discussion Forum
Web Links
News Categories
Photo Gallery
Search
SourceForge
SourceForge.net Logo
Google
Require, Include, PHP & all that jazz!
First thing first; These functions are indispensible to the PHP programmer! Without them code would be either very long, repeated time after time or just plain difficult.




Including files is a valuable function and makes for slimmer scripts as well as being able to reuse functions (or most anything) instead of having to type them in each script.



What's the difference between include() and require()?



The difference is that when you use include() it returns just a warning, but doesn't terminate the script; whereas require() exits with a fatal error and nothing much e;se will happen.



Got that?



Yeah, but what about include_once() and require_once()?



The same as above, but with a twist! The _once part tells php to load that script "once only". If you then try and include that same file again you'll receive either an error or warning or silently fail. The best thing about require_once() and include_once() over just their normal cousins is that you wont overwrite and variables, or function definitions already initialised

Posted by CoLdFuSiOn on November 21 2006 06:21:45 9015 Reads · Print
Login
Username

Password



Forgotten your password?
Request a new one here.
Latest Articles
Installing WebMin
Newbie Guide to Sett...
Useful SSH Commands
Require, Include, PH...
Trouble with PATH_INFO?
Copyright © 2006