Thread: PHP Question
View Single Post
Old 05-18-07, 02:22 PM   #17
fivefeet8
Ngemu Mod
 
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: PHP Question

Quote:
Originally Posted by ViN86
ill probably end up referencing multiple functions from the same file, so ill use require() so i dont end up calling the require_once() multiple times (i agree multiple instances is a poor technique ghost)
I think in your case, either require_once() or require() will work because you'd still only be calling one instance. Since all the functions you need will be located on a single php script. Maybe you think require_once() means you need to require the file again if you need the function again on the same page. Which isn't the case.

Require_once() simply checks to see if you've already included an instance. If you have, it will not include it again. If you haven't, it will include it. Require() does not check and will include an instance again no matter if you've already included it or not.

I only suggested require_once() because if the plan to extend into OOP programming later on, require() may cause errors if your classes reference other classes.
__________________
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote