cvs: phpdoc /en/functions funchand.xml var.xml

From: Date: Wed, 07 Mar 2001 10:40:02 +0000
Subject: cvs: phpdoc /en/functions funchand.xml var.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969334592@lists.php.net to get a copy of this message
jmcastagnetto Wed Mar 7 02:40:02 2001 EDT Modified files: /phpdoc/en/functions funchand.xml var.xml Log: Added documentation and examples for get_declared_vars, get_declared_functions and get_resource_type Index: phpdoc/en/functions/funchand.xml diff -u phpdoc/en/functions/funchand.xml:1.5 phpdoc/en/functions/funchand.xml:1.6 --- phpdoc/en/functions/funchand.xml:1.5 Sat Jan 20 13:08:27 2001 +++ phpdoc/en/functions/funchand.xml Wed Mar 7 02:40:02 2001 @@ -395,6 +395,72 @@ </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 "&gt;tr&lt;&gt;th&lt;$id&gt;/th&lt;&gt;td&lt;$data&gt;/td&lt;&gt;/tr&lt;\n"; +} + +$arr = get_defined_functions(); + +print_r($arr); + </programlisting> + </informalexample> + </para> + <para> + Will output something along the lines of: + <computeroutput> +Array +( + [internal] =&gt; Array + ( + [0] =&gt; zend_version + [1] =&gt; func_num_args + [2] =&gt; func_get_arg + [3] =&gt; func_get_args + [4] =&gt; strlen + [5] =&gt; strcmp + [6] =&gt; strncmp + ... + [750] =&gt; bcscale + [751] =&gt; bccomp + ) + + [user] =&gt; Array + ( + [0] =&gt; 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> Index: phpdoc/en/functions/var.xml diff -u phpdoc/en/functions/var.xml:1.33 phpdoc/en/functions/var.xml:1.34 --- phpdoc/en/functions/var.xml:1.33 Sat Jan 20 13:08:27 2001 +++ phpdoc/en/functions/var.xml Wed Mar 7 02:40:02 2001 @@ -142,6 +142,93 @@ </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>

« previous php.doc (#969334592) next »