Jump to content

attention php gurus: array for include statement speed


snrecords

Recommended Posts

Hey all,

 

I found some cool article with code that creates a shortcut for all include statements. 

 

$alldirectories = array(
dirname( __FILE__ ).'/',
dirname( __FILE__ ).'/ab/',
dirname( __FILE__ ).'/abc/',
dirname( __FILE__ ).'/abcd/',
dirname( __FILE__ ).'/abcde/');

$pathname = ini_get( 'include_path' );
foreach( $alldirectories as $onedirectory ) {
$pathname .= PATH_SEPARATOR.$onedirectory;
}

ini_set( 'include_path', $pathname );

 

To explain further, this code allows me to use an include statement without writing the entire path. (e.g. include("somefileinoneofmydirectories.php");).

 

In the article, it stated that this a great shortcut method increasing the speed of the code and so forth.

 

My question is ... does this code really make my php processing quicker?  Are there better alternatives to this code?

 

Any feedback will be appreciated.  THANKS!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.