hd:working_notes
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| hd:working_notes [2005/10/03 21:12] – (old revision restored) 127.0.0.1 | hd:working_notes [2020/11/23 17:23] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| * per-user settings can be stored in a more or less standard way using hook_user and/or user_save | * per-user settings can be stored in a more or less standard way using hook_user and/or user_save | ||
| + | * something strange in PHP. It seems that global arrays defined in an INCLUDED files are local to the included file and their range disappears in the including file: | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | // foo.php | ||
| + | $ar = array(' | ||
| + | |||
| + | function baz() | ||
| + | { | ||
| + | global $ar ; | ||
| + | echo is_array($ar) ? ' | ||
| + | } | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | // bar.php | ||
| + | include ' | ||
| + | |||
| + | baz(); | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | // qux.php | ||
| + | require ' | ||
| + | baz(); | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | * qux.php displays True as expected. | ||
| + | * bar.php displays False (???) | ||
| + | * bug, feature, or test error ? | ||
| + | * Tested with PHP 5.0.4 | ||
hd/working_notes.1128373979.txt.gz · Last modified: (external edit)
