note 77465 added to function.include

From: Date: Thu, 30 Aug 2007 17:37:40 +0000
Subject: note 77465 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-129912@lists.php.net to get a copy of this message
With a large system you might have lots of functions. I have noticed that this can produce large memory overhead, some of which can be alleviated by using includes in the following manner: e.g. <?php function foo() { //some long block of code here producing $bar return $bar; } ?> can be rewritten as: <?php function foo() { return include "foo.php"; } ?> where foo.php contains the following: <?php //long block of code producing $bar return $bar; ?> The result is the function's body does not get loaded into memory until the function is actually called. ---- Server IP: 69.147.83.197 Probable Submitter: 71.189.57.4 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/77465 Del: integrated -- https://master.php.net/note/delete/77465/integrated Del: useless -- https://master.php.net/note/delete/77465/useless Del: bad code -- https://master.php.net/note/delete/77465/bad+code Del: spam -- https://master.php.net/note/delete/77465/spam Del: non-english -- https://master.php.net/note/delete/77465/non-english Del: in docs -- https://master.php.net/note/delete/77465/in+docs Del: other reasons-- https://master.php.net/note/delete/77465 Reject -- https://master.php.net/note/reject/77465 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129912) next »