[UPHPU] Do you include,
require or something else custom PHP libraries?
Craig Jackson
CJackson at cirris.com
Wed Apr 16 09:00:11 MDT 2008
Bah, I hit the reply to sender again (sorry for the duplicate, Nathan). Here is my reply for everyone else.
require and include are the same, except require will throw a fatal error if there is a problem with the file, whereas include will try to continue through.
I usually use require, so there will not be anything else processed if I cannot get the file for some reason. Also, I use require_once/include_once for most of my file inclusions to make sure files are not trying to be included more than once.
So to answer your question, if you need this file no matter what, then run a require. If you would still like to continue even if there is a problem with the file, then use include. Then add _once if there is any possibility of including the file twice, and you do not want the file to be re-included. Which command is determined by what you need/want from the file.
Craig Jackson
Web Developer
-----Original Message-----
From: uphpu-bounces at uphpu.org [mailto:uphpu-bounces at uphpu.org]On Behalf
Of Nathan Lane
Sent: Wednesday, April 16, 2008 8:44 AM
To: UPHPU Discuss
Subject: [UPHPU] Do you include,require or something else custom PHP
libraries?
Do you include, require or something else custom PHP libraries? By custom
PHP libraries, I mean PHP files, containing functions and classes that I've
created. For example I have a PHP file containing multiple custom Exception
classes, and I want to use those exceptions in my other class libraries, so
how would I go about doing that properly?
--
Nathan Lane
Home, http://www.nathandelane.com
Blog, http://nathandelane.blogspot.com
_______________________________________________
UPHPU mailing list
UPHPU at uphpu.org
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net
More information about the UPHPU
mailing list