people are pretty boring unless they are interesting; Explore everything
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| #Global Namespace $test = '123'; $document_root = $_SERVER['DOCUMENT_ROOT']; testme(); testme2(); function testme() { echo $GLOBALS['test'] . "<BR />\n"; echo $_SERVER['DOCUMENT_ROOT'] . "<BR />\n"; } function testme2() { global $test; echo $test . "<BR />\n"; } |
[ Voor 28% gewijzigd door glashio op 23-08-2005 13:25 ]
> Google Certified Searcher
> Make users so committed to Google that it would be painful to leave
> C64 Gospel
> [SjoQ] = SjoQing
1. Je wilt een variabele zetten en deze in andere pagina's nog uit kunnen lezen. In dit geval gebruik je inderdaad sessions.
2. Je wilt gewoon globale variabelen die je eenmaal kunt zetten (config) en die overal tot je beschikking hebben. In dit geval kun je natuurlijk gewoon een config include maken die je overal ingooit.
Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'
/edit en jij ook Janoz voor je addendum
[ Voor 18% gewijzigd door lekkerliegen op 23-08-2005 13:57 ]
people are pretty boring unless they are interesting; Explore everything