note 98400 added to function.include

From: Date: Sat, 12 Jun 2010 22:23:59 +0000
Subject: note 98400 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-170090@lists.php.net to get a copy of this message
The 'include' family of constructs uses caching to ensure an included file is cached rather than read again. However, it only does this once during any particular script, so if the included file changes between one inclusion and the next then the old content is read back. For example: <?php $config = include 'my_config_array.php'; ... // Manipulate the config file here and save it (e.g. with Zend_Config_Writer_Array) ... // Re-read the updated config. $config = include 'my_config_array.php'; ?> Even though the included file has changed the second include will return the same content as the first include. You may be asking 'Why not used .ini files instead?' - have you actually benchmarked ini files vs 'return array'? Thought not. ;-) You should use alternative methods to read your config file. ---- Server IP: 69.147.83.197 Probable Submitter: 80.3.156.124 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/98400 Del: integrated -- https://master.php.net/note/delete/98400/integrated Del: useless -- https://master.php.net/note/delete/98400/useless Del: bad code -- https://master.php.net/note/delete/98400/bad+code Del: spam -- https://master.php.net/note/delete/98400/spam Del: non-english -- https://master.php.net/note/delete/98400/non-english Del: in docs -- https://master.php.net/note/delete/98400/in+docs Del: other reasons-- https://master.php.net/note/delete/98400 Reject -- https://master.php.net/note/reject/98400 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170090) next »