Superglobals — Superglobals are built-in variables that are always available in all scopes


Several predefined variables in PHP are "superglobals", which means they are available in all scopes throughout a script. There is no need to do global $variable; to access them within functions or methods.

These superglobal variables are:


4.1.0 Superglobals were introduced to PHP.


NoteVariable availability
By default, all of the superglobals are available but there are directives that affect this availability. For further information, refer to the documentation for variables_order

NoteDealing with register_globals
If the deprecated register_globals directive is set to on then the variables within will also be made available in the global scope of the script. For example, $_POST['foo'] would also exist as $foo
For related information, see the FAQ titled "How does register_globals affect me?

NoteVariable variables
Superglobals cannot be used as variable variables inside functions or class methods. 

'php' 카테고리의 다른 글

제로보드4 게시판의 취약성을 이용한 파일 변조 알림  (0) 2010.12.20
PHP $_SERVER[] 함수  (0) 2010.10.18
Superglobals  (0) 2010.02.09
PHP 5.0.x부터 바뀐 것들  (0) 2010.02.09
$QUERY_STRING  (0) 2009.12.28
GET 또는 POST로 전송된 변수명, 변수값 확인  (0) 2009.12.28

+ Recent posts