php-doc-en/reference/var/functions/get-defined-vars.xml
2003-05-30 16:58:05 +00:00

75 lines
1.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.34 -->
<refentry id="function.get-defined-vars">
<refnamediv>
<refname>get_defined_vars</refname>
<refpurpose>
Returns an array of all defined variables
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>get_defined_vars</methodname>
<void/>
</methodsynopsis>
<para>
This function returns an multidimensional array containing a list of
all defined variables, be them environment, server or user-defined
variables.
<informalexample>
<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 paramaters 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>
</informalexample>
</para>
<para>
See also <function>get_defined_functions</function> and
<function>get_defined_constants</function>.
</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:"../../../../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
-->