mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
Added documentation and examples for get_declared_vars, get_declared_functions
and get_resource_type git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@42866 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
236bf4c3f8
commit
411b3e0f55
2 changed files with 153 additions and 0 deletions
|
@ -395,6 +395,72 @@ if (function_exists('imap_open')) {
|
|||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.get-defined-functions">
|
||||
<refnamediv>
|
||||
<refname>get_defined_functions</refname>
|
||||
<refpurpose>
|
||||
Returns an array of all defined functions
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>array <function>get_defined_functions</function></funcdef>
|
||||
<paramdef>void <parameter></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns an multidimensional array containing a list of
|
||||
all defined functions, both built-in (internal) and user-defined. The
|
||||
internal functions will be accessible via
|
||||
<varname>$arr["internal"]</varname>, and the user defined ones using
|
||||
<varname>$arr["user"]</varname> (see example below).
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
function mytable($id, $data) {
|
||||
return ">tr<>th<$id>/th<>td<$data>/td<>/tr<\n";
|
||||
}
|
||||
|
||||
$arr = get_defined_functions();
|
||||
|
||||
print_r($arr);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
Will output something along the lines of:
|
||||
<computeroutput>
|
||||
Array
|
||||
(
|
||||
[internal] => Array
|
||||
(
|
||||
[0] => zend_version
|
||||
[1] => func_num_args
|
||||
[2] => func_get_arg
|
||||
[3] => func_get_args
|
||||
[4] => strlen
|
||||
[5] => strcmp
|
||||
[6] => strncmp
|
||||
...
|
||||
[750] => bcscale
|
||||
[751] => bccomp
|
||||
)
|
||||
|
||||
[user] => Array
|
||||
(
|
||||
[0] => myrow
|
||||
)
|
||||
|
||||
)
|
||||
</computeroutput>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>get_defined_vars</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.register-shutdown-function">
|
||||
<refnamediv>
|
||||
<refname>register_shutdown_function</refname>
|
||||
|
|
|
@ -142,6 +142,93 @@ if (!isset($var)) { // evaluates false
|
|||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.get-defined-vars">
|
||||
<refnamediv>
|
||||
<refname>get_defined_vars</refname>
|
||||
<refpurpose>
|
||||
Returns an array of all defined functions
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>array <function>get_defined_vars</function></funcdef>
|
||||
<paramdef>void <parameter></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<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">
|
||||
$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["HTTP_SERVER_VARS"]);
|
||||
|
||||
// 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>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.get-resource-type">
|
||||
<refnamediv>
|
||||
<refname>get_resource_type</refname>
|
||||
<refpurpose>
|
||||
Returns a the type of a resource
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>string <function>get_resource_type</function></funcdef>
|
||||
<paramdef>resource <parameter>$handle</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
This function returns a string representing the type of the resource
|
||||
passed to it. If the paramater is not a valid resource, it
|
||||
generates an error.
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
$c = mysql_connect();
|
||||
echo get_resource_type($c)."\n";
|
||||
// prints: mysql link
|
||||
|
||||
$fp = fopen("foo","w");
|
||||
echo get_resource_type($fp)."\n";
|
||||
// prints: file
|
||||
|
||||
$doc = new_xmldoc("1.0");
|
||||
echo get_resource_type($doc->doc)."\n";
|
||||
// prints: domxml document
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.intval">
|
||||
<refnamediv>
|
||||
<refname>intval</refname>
|
||||
|
|
Loading…
Reference in a new issue