<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision$ --> <refentry xml:id="function.get-defined-vars" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>get_defined_vars</refname> <refpurpose> Returns an array of all defined variables </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>get_defined_vars</methodname> <void/> </methodsynopsis> <para> This function returns a multidimensional array containing a list of all defined variables, be them environment, server or user-defined variables, within the scope that <function>get_defined_vars</function> is called. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> A multidimensional array with all the variables. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>get_defined_vars</function> Example</title> <programlisting role="php"> <![CDATA[ <?php $b = array(1, 1, 2, 3, 5, 8); $arr = get_defined_vars(); // print $b print_r($arr["b"]); /* print path to the PHP interpreter (if used as a CGI) * e.g. /usr/local/bin/php */ echo $arr["_"]; // print the command-line parameters if any print_r($arr["argv"]); // print all the server vars print_r($arr["_SERVER"]); // print all the available keys for the arrays of variables print_r(array_keys(get_defined_vars())); ?> ]]> </programlisting> </example> </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>5.0.0</entry> <entry> The <varname>$GLOBALS</varname> variable is included in the results of the array returned. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>isset</function></member> <member><function>get_defined_functions</function></member> <member><function>get_defined_constants</function></member> </simplelist> </para> </refsect1> </refentry> <!-- 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 -->