note 75434 added to function.include
| From: | cmedinaatbluecorestudiodotcom at osu1 dot php dot net | Date: | Wed, 30 May 2007 05:10:02 +0000 |
| Subject: | note 75434 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127008@lists.php.net to get a copy of this message | ||
A small fix to code of nested includes I added before...
When the var $FILE_PATH is used in different nested includes, the $FILE_PATH is replaced within each
include, and can cause an error (because a second level include replaces the path of the first level
includes and third replaces second's and so on), so to avoid this you should use unique
varnames for each path. This could be easily resolved by replacing the var $FILE_PATH with something
like this:
<?
${"C".sha1(__FILE__)} = ...
?>
where "C" is to avoid the varname to start with a number (which would cause an error).
Also, unique varnames by hand can be used to avoid consecutive calls to sha1, but in my case I
prefer the hash var method. Use what best fits to your needs.
----
Server IP: 69.39.81.135
Probable Submitter: 64.237.238.161
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- https://master.php.net/note/edit/75434
Del: integrated -- https://master.php.net/note/delete/75434/integrated
Del: useless -- https://master.php.net/note/delete/75434/useless
Del: bad code -- https://master.php.net/note/delete/75434/bad+code
Del: spam -- https://master.php.net/note/delete/75434/spam
Del: non-english -- https://master.php.net/note/delete/75434/non-english
Del: in docs -- https://master.php.net/note/delete/75434/in+docs
Del: other reasons-- https://master.php.net/note/delete/75434
Reject -- https://master.php.net/note/reject/75434
Search -- https://master.php.net/manage/user-notes.php