Re: Header files in PHP

From: Date: Thu, 21 Aug 2014 20:19:44 +0000
Subject: Re: Header files in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-323779@lists.php.net to get a copy of this message
On 8/21/2014 1:20 PM, Paul M Foster wrote:
Folks: Over the years, I've heard a lot of back and forth about require_once, require, include, include_once and he like. Most of it centers around the CPU time taken to execute these calls. The "C" way to do something similar is to define a constant in a header file and then check for its existence in the C code file. In PHP, this would be roughly like this: LIBRARY FILE: define('CONST_DATE', TRUE); CODE FILE: if (!defined('CONST_DATE')) include('date.lib.php'); Has anyone ever compared execute times to see if something like this would be "cheaper" than include/require[_once]? Any thoughts on it? Paul I dont' understand your question. Basically the use of include/require et al, is to include code from other stand-alone units. It's not just looking for some one little thing such as a constant value to exist. It's using a modular style of programming and putting the pieces together at call time using require/include, etc.
Am I missing the question here?

« previous php.general (#323779) next »