File: superglobals.xml

package info (click to toggle)
php-doc 20140201-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 74,084 kB
  • ctags: 4,040
  • sloc: xml: 998,137; php: 20,812; cpp: 500; sh: 177; makefile: 63; awk: 28
file content (125 lines) | stat: -rw-r--r-- 3,726 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 288721 $ -->

<phpdoc:varentry xmlns:phpdoc="http://php.net/ns/phpdoc" xml:id="language.variables.superglobals" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" role="noversion">
 <refnamediv>
  <refname>Superglobals</refname>
  <refpurpose>Superglobals are built-in variables that are always available in all scopes</refpurpose>
 </refnamediv>
 
 <refsect1 role="description">
  &reftitle.description;
  <para>
   Several predefined variables in PHP are "superglobals", which means they
   are available in all scopes throughout a script. There is no need to do
   <command>global $variable;</command> to access them within functions
   or methods.
  </para>
  <para>
   These superglobal variables are:
   <simplelist>
    <member><varname>$GLOBALS</varname></member>
    <member><varname>$_SERVER</varname></member>
    <member><varname>$_GET</varname></member>
    <member><varname>$_POST</varname></member>
    <member><varname>$_FILES</varname></member>
    <member><varname>$_COOKIE</varname></member>
    <member><varname>$_SESSION</varname></member>
    <member><varname>$_REQUEST</varname></member>
    <member><varname>$_ENV</varname></member>
   </simplelist>
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>4.1.0</entry>
       <entry>
        Superglobals were introduced to PHP.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <title>Variable availability</title>
   <para>
    By default, all of the superglobals are available but there are
    directives that affect this availability. For further information, refer
    to the documentation for
    <link linkend="ini.variables-order">variables_order</link>.
   </para>
  </note>
  <note>
   <title>Dealing with register_globals</title>
   <para>
    If the deprecated <link linkend="ini.register-globals">register_globals</link>
    directive is set to <literal>on</literal> then the variables within will
    also be made available in the global scope of the script. For example,
    <varname>$_POST['foo']</varname> would also exist as <varname>$foo</varname>.
   </para>
   <para>
    For related information, see the FAQ titled 
    "<link linkend="faq.register-globals">How does register_globals affect me?</link>"
   </para>
  </note>
  <note>
   <title>Variable variables</title>
   <para>
    Superglobals cannot be used as 
    <link linkend="language.variables.variable">variable variables</link>
    inside functions or class methods.
   </para>
  </note>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><link linkend="language.variables.scope">variable scope</link></member>
    <member>The <link linkend="ini.variables-order">variables_order</link> directive</member>
    <member><link linkend="book.filter">The filter extension</link></member>
   </simplelist>
  </para>
 </refsect1>

</phpdoc:varentry>
 
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->