snrecords Posted March 25, 2009 Share Posted March 25, 2009 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!! Link to comment https://forums.phpfreaks.com/topic/151020-attention-php-gurus-array-for-include-statement-speed/ Share on other sites More sharing options...
Yesideez Posted March 25, 2009 Share Posted March 25, 2009 If you want speed then hard code values directly in and don't use includes like these. On another serious note the speed issues won't be a problem. Link to comment https://forums.phpfreaks.com/topic/151020-attention-php-gurus-array-for-include-statement-speed/#findComment-793394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.