note 98400 deleted from function.include by danbrown

From: Date: Sun, 13 Jun 2010 02:28:01 +0000
Subject: note 98400 deleted from function.include by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170094@lists.php.net to get a copy of this message
Note Submitter: anton dot clarke at zuvvi dot com ---- 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.

« previous php.notes (#170094) next »