note 19527 deleted from function.require by spic

From: Date: Wed, 28 Aug 2002 08:08:06 +0000
Subject: note 19527 deleted from function.require by spic
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35861@lists.php.net to get a copy of this message
[Editor's note: This is amazingly inefficient] Alternative function of the php "require". If you need to require("file.php") multiple time like this exemple : for ($t=1; $t<=300; $t++) { require("file.php"); } You can use this function to increase speed by caching the content. function required($fileName) { global $buffer; if (!isset($buffer[$fileName])) { $fp = fopen($fileName, "r"); while (!feof($fp)) $buffer[$fileName].=fgets($fp,4096); } eval("?".">" . $buffer[$fileName] . "<"."?"); }

« previous php.notes (#35861) next »