WS, prepapre for new doc style

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@230097 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2007-02-17 20:02:43 +00:00
parent d64e67e62f
commit c87c5a1992
11 changed files with 524 additions and 541 deletions

View file

@ -1,33 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.14 $ -->
<!-- $Revision: 1.15 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.10 -->
<refentry id="function.call-user-func-array">
<refnamediv>
<refname>call_user_func_array</refname>
<refpurpose>
Call a user function given with an array of parameters
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>call_user_func_array</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam><type>array</type><parameter>param_arr</parameter></methodparam>
</methodsynopsis>
<para>
Call a user defined function given by
<parameter>function</parameter>, with
the parameters in <parameter>param_arr</parameter>.
For example:
</para>
<para>
<example>
<title><function>call_user_func_array</function> example</title>
<programlisting role="php">
<refentry id="function.call-user-func-array">
<refnamediv>
<refname>call_user_func_array</refname>
<refpurpose>Call a user function given with an array of parameters</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>call_user_func_array</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam><type>array</type><parameter>param_arr</parameter></methodparam>
</methodsynopsis>
<para>
Call a user defined function given by
<parameter>function</parameter>, with
the parameters in <parameter>param_arr</parameter>.
For example:
</para>
<para>
<example>
<title><function>call_user_func_array</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
function debug($var, $val)
function debug($var, $val)
{
echo "***DEBUGGING\nVARIABLE: $var\nVALUE:";
if (is_array($val) || is_object($val) || is_resource($val)) {
@ -46,16 +44,16 @@ call_user_func_array('debug', array("c", $c));
call_user_func_array('debug', array("_POST", $_POST));
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>call_user_func</function>,
and &seealso.callback;
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>call_user_func</function>,
and &seealso.callback;
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,32 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.14 $ -->
<!-- $Revision: 1.15 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.call-user-func">
<refnamediv>
<refname>call_user_func</refname>
<refpurpose>
Call a user function given by the first parameter
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>call_user_func</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<para>
Call a user defined function given by the
<parameter>function</parameter> parameter. Take the
following:
</para>
<para>
<informalexample>
<programlisting role="php">
<refentry id="function.call-user-func">
<refnamediv>
<refname>call_user_func</refname>
<refpurpose>Call a user function given by the first parameter</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>call_user_func</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<para>
Call a user defined function given by the
<parameter>function</parameter> parameter. Take the
following:
</para>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function barber($type)
function barber($type)
{
echo "You wanted a $type haircut, no problem";
}
@ -34,19 +32,19 @@ call_user_func('barber', "mushroom");
call_user_func('barber', "shave");
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
Class methods may also be invoked statically using this function
by passing <literal>array($classname, $methodname)</literal> to
the <parameter>function</parameter> parameter.
<informalexample>
<programlisting role="php">
</programlisting>
</informalexample>
</para>
<para>
Class methods may also be invoked statically using this function
by passing <literal>array($classname, $methodname)</literal> to
the <parameter>function</parameter> parameter.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
class myclass {
function say_hello()
function say_hello()
{
echo "Hello!\n";
}
@ -57,15 +55,15 @@ $classname = "myclass";
call_user_func(array($classname, 'say_hello'));
?>
]]>
</programlisting>
</informalexample>
</para>
<note>
<para>
Note that the parameters for <function>call_user_func</function> are not
passed by reference.
<informalexample>
<programlisting role="php">
</programlisting>
</informalexample>
</para>
<note>
<para>
Note that the parameters for <function>call_user_func</function> are not
passed by reference.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function increment(&$var)
@ -81,18 +79,18 @@ call_user_func_array('increment', array(&$a)); // You can use this instead
echo $a; // 1
?>
]]>
</programlisting>
</informalexample>
</para>
</note>
<para>
See also:
<function>is_callable</function>,
<function>call_user_func_array</function>,
&listendand; &seealso.callback;.
</para>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
</note>
<para>
See also:
<function>is_callable</function>,
<function>call_user_func_array</function>,
&listendand; &seealso.callback;.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.create-function">
<refnamediv>
<refname>create_function</refname>
<refpurpose>Create an anonymous (lambda-style) function</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>create_function</methodname>
<methodparam><type>string</type><parameter>args</parameter></methodparam>
<methodparam><type>string</type><parameter>code</parameter></methodparam>
</methodsynopsis>
<para>
Creates an anonymous function from the parameters passed, and
returns a unique name for it. Usually the
<parameter>args</parameter> will be passed as a single quote
delimited string, and this is also recommended for the
<parameter>code</parameter>. The reason for using single quoted
strings, is to protect
the variable names from parsing, otherwise, if you use double
quotes there will be a need to escape the variable names, e.g.
<literal>\$avar</literal>.
</para>
<para>
You can use this function, to (for example) create a function
from information gathered at run time:
</para>
<para>
<example>
<title>
Creating an anonymous function with <function>create_function</function>
</title>
<programlisting role="php">
<refentry id="function.create-function">
<refnamediv>
<refname>create_function</refname>
<refpurpose>Create an anonymous (lambda-style) function</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>create_function</methodname>
<methodparam><type>string</type><parameter>args</parameter></methodparam>
<methodparam><type>string</type><parameter>code</parameter></methodparam>
</methodsynopsis>
<para>
Creates an anonymous function from the parameters passed, and
returns a unique name for it. Usually the
<parameter>args</parameter> will be passed as a single quote
delimited string, and this is also recommended for the
<parameter>code</parameter>. The reason for using single quoted
strings, is to protect
the variable names from parsing, otherwise, if you use double
quotes there will be a need to escape the variable names, e.g.
<literal>\$avar</literal>.
</para>
<para>
You can use this function, to (for example) create a function
from information gathered at run time:
</para>
<para>
<example>
<title>
Creating an anonymous function with <function>create_function</function>
</title>
<programlisting role="php">
<![CDATA[
<?php
$newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');
@ -44,23 +44,23 @@ echo $newfunc(2, M_E) . "\n";
// ln(2) + ln(2.718281828459) = 1.6931471805599
?>
]]>
</programlisting>
</example>
</para>
<para>
Or, perhaps to have general handler function that can apply a set
of operations to a list of parameters:
</para>
<para>
<example>
<title>
Making a general processing function with
<function>create_function</function>
</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
Or, perhaps to have general handler function that can apply a set
of operations to a list of parameters:
</para>
<para>
<example>
<title>
Making a general processing function with
<function>create_function</function>
</title>
<programlisting role="php">
<![CDATA[
<?php
function process($var1, $var2, $farr)
function process($var1, $var2, $farr)
{
foreach ($farr as $f) {
echo $f($var1, $var2) . "\n";
@ -94,11 +94,11 @@ echo "\nUsing the second array of anonymous functions\n";
process("Twas brilling and the slithy toves", "Twas the night", $garr);
?>
]]>
</programlisting>
<para>
and when you run the code above, the output will be:
</para>
<screen>
</programlisting>
<para>
and when you run the code above, the output will be:
</para>
<screen>
<![CDATA[
Using the first array of anonymous functions
parameters: 2.3445, M_PI
@ -114,30 +114,30 @@ Using the second array of anonymous functions
CRCs: -725381282 , 1908338681
similar(a,b) = 11(45.833333333333%)
]]>
</screen>
</example>
</para>
<para>
But perhaps the most common use for of lambda-style (anonymous) functions
is to create callback functions, for example when using
<function>array_walk</function> or <function>usort</function>
</para>
<para>
<example>
<title>Using anonymous functions as callback functions</title>
<programlisting role="php">
</screen>
</example>
</para>
<para>
But perhaps the most common use for of lambda-style (anonymous) functions
is to create callback functions, for example when using
<function>array_walk</function> or <function>usort</function>
</para>
<para>
<example>
<title>Using anonymous functions as callback functions</title>
<programlisting role="php">
<![CDATA[
<?php
$av = array("the ", "a ", "that ", "this ");
array_walk($av, create_function('&$v,$k', '$v = $v . "mango";'));
print_r($av);
print_r($av);
?>
]]>
</programlisting>
<para>
outputs:
</para>
<screen>
</programlisting>
<para>
outputs:
</para>
<screen>
<![CDATA[
Array
(
@ -147,11 +147,11 @@ Array
[3] => this mango
)
]]>
</screen>
<para>
an array of strings ordered from shorter to longer
</para>
<programlisting role="php">
</screen>
<para>
an array of strings ordered from shorter to longer
</para>
<programlisting role="php">
<![CDATA[
<?php
@ -160,11 +160,11 @@ print_r($sv);
?>
]]>
</programlisting>
<para>
outputs:
</para>
<screen>
</programlisting>
<para>
outputs:
</para>
<screen>
<![CDATA[
Array
(
@ -174,11 +174,11 @@ Array
[3] => it is a string thing
)
]]>
</screen>
<para>
sort it from longer to shorter
</para>
<programlisting role="php">
</screen>
<para>
sort it from longer to shorter
</para>
<programlisting role="php">
<![CDATA[
<?php
@ -187,11 +187,11 @@ print_r($sv);
?>
]]>
</programlisting>
<para>
outputs:
</para>
<screen>
</programlisting>
<para>
outputs:
</para>
<screen>
<![CDATA[
Array
(
@ -201,11 +201,11 @@ Array
[3] => small
)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,63 +1,63 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.func-get-arg">
<refnamediv>
<refname>func_get_arg</refname>
<refpurpose>Return an item from the argument list</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>func_get_arg</methodname>
<methodparam><type>int</type><parameter>arg_num</parameter></methodparam>
</methodsynopsis>
<simpara>
Returns the argument which is at the
<parameter>arg_num</parameter>'th offset into a user-defined
function's argument list. Function arguments are counted starting
from zero. <function>func_get_arg</function> will generate a
warning if called from outside of a function definition.
This function cannot be used directly as a function parameter. Instead,
its result may be assigned to a variable, which can then be passed to
the function.
</simpara>
<simpara>
If <parameter>arg_num</parameter> is greater than the number of
arguments actually passed, a warning will be generated and
<function>func_get_arg</function> will return &false;.
</simpara>
<refentry id="function.func-get-arg">
<refnamediv>
<refname>func_get_arg</refname>
<refpurpose>Return an item from the argument list</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>func_get_arg</methodname>
<methodparam><type>int</type><parameter>arg_num</parameter></methodparam>
</methodsynopsis>
<simpara>
Returns the argument which is at the
<parameter>arg_num</parameter>'th offset into a user-defined
function's argument list. Function arguments are counted starting
from zero. <function>func_get_arg</function> will generate a
warning if called from outside of a function definition.
This function cannot be used directly as a function parameter. Instead,
its result may be assigned to a variable, which can then be passed to
the function.
</simpara>
<simpara>
If <parameter>arg_num</parameter> is greater than the number of
arguments actually passed, a warning will be generated and
<function>func_get_arg</function> will return &false;.
</simpara>
&note.funcnoparam;
&note.funcnoparam;
<para>
<informalexample>
<programlisting role="php">
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo()
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs<br />\n";
if ($numargs >= 2) {
echo "Second argument is: " . func_get_arg(1) . "<br />\n";
}
}
}
foo (1, 2, 3);
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
<function>func_get_arg</function> may be used in conjunction with
<function>func_num_args</function> and
<function>func_get_args</function> to allow user-defined
functions to accept variable-length argument lists.
</simpara>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
<simpara>
<function>func_get_arg</function> may be used in conjunction with
<function>func_num_args</function> and
<function>func_get_args</function> to allow user-defined
functions to accept variable-length argument lists.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,43 +1,41 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.func-get-args">
<refnamediv>
<refname>func_get_args</refname>
<refpurpose>
Returns an array comprising a function's argument list
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>func_get_args</methodname>
<void/>
</methodsynopsis>
<simpara>
Returns an array in which each element is a copy of the corresponding
member of the current user-defined function's argument
list. <function>func_get_args</function> will generate a warning
if called from outside of a function definition.
This function cannot be used directly as a function parameter. Instead,
its result may be assigned to a variable, which can then be passed to
the function.
</simpara>
<note>
<simpara>
This function returns a copy of the passed arguments only, and does not
account for default (non-passed) arguments.
</simpara>
</note>
<refentry id="function.func-get-args">
<refnamediv>
<refname>func_get_args</refname>
<refpurpose>Returns an array comprising a function's argument list</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>func_get_args</methodname>
<void/>
</methodsynopsis>
<simpara>
Returns an array in which each element is a copy of the corresponding
member of the current user-defined function's argument
list. <function>func_get_args</function> will generate a warning
if called from outside of a function definition.
This function cannot be used directly as a function parameter. Instead,
its result may be assigned to a variable, which can then be passed to
the function.
</simpara>
<note>
<simpara>
This function returns a copy of the passed arguments only, and does not
account for default (non-passed) arguments.
</simpara>
</note>
&note.funcnoparam;
&note.funcnoparam;
<para>
<informalexample>
<programlisting role="php">
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo()
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs<br />\n";
@ -48,22 +46,22 @@ function foo()
for ($i = 0; $i < $numargs; $i++) {
echo "Argument $i is: " . $arg_list[$i] . "<br />\n";
}
}
}
foo(1, 2, 3);
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
<function>func_get_args</function> may be used in conjunction
with <function>func_num_args</function> and
<function>func_get_arg</function> to allow user-defined functions
to accept variable-length argument lists.
</simpara>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
<simpara>
<function>func_get_args</function> may be used in conjunction
with <function>func_num_args</function> and
<function>func_get_arg</function> to allow user-defined functions
to accept variable-length argument lists.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,55 +1,53 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.func-num-args">
<refnamediv>
<refname>func_num_args</refname>
<refpurpose>
Returns the number of arguments passed to the function
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>func_num_args</methodname>
<void/>
</methodsynopsis>
<simpara>
Returns the number of arguments passed into the current
user-defined function. <function>func_num_args</function> will
generate a warning if called from outside of a user-defined function.
This function cannot be used directly as a function parameter. Instead,
its result may be assigned to a variable, which can then be passed to
the function.
</simpara>
&note.funcnoparam;
<para>
<informalexample>
<programlisting role="php">
<refentry id="function.func-num-args">
<refnamediv>
<refname>func_num_args</refname>
<refpurpose>Returns the number of arguments passed to the function</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>func_num_args</methodname>
<void/>
</methodsynopsis>
<simpara>
Returns the number of arguments passed into the current
user-defined function. <function>func_num_args</function> will
generate a warning if called from outside of a user-defined function.
This function cannot be used directly as a function parameter. Instead,
its result may be assigned to a variable, which can then be passed to
the function.
</simpara>
&note.funcnoparam;
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo()
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs\n";
}
}
foo(1, 2, 3); // Prints 'Number of arguments: 3'
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
<function>func_num_args</function> may be used in conjunction
with <function>func_get_arg</function> and
<function>func_get_args</function> to allow user-defined
functions to accept variable-length argument lists.
</simpara>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
<simpara>
<function>func_num_args</function> may be used in conjunction
with <function>func_get_arg</function> and
<function>func_get_args</function> to allow user-defined
functions to accept variable-length argument lists.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,26 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.function-exists">
<refnamediv>
<refname>function_exists</refname>
<refpurpose>
Return &true; if the given function has been defined
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>function_exists</methodname>
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
</methodsynopsis>
<para>
Checks the list of defined functions, both built-in (internal) and
user-defined, for <parameter>function_name</parameter>. &return.success;
</para>
<para>
<informalexample>
<programlisting role="php">
<refentry id="function.function-exists">
<refnamediv>
<refname>function_exists</refname>
<refpurpose>Return &true; if the given function has been defined</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>function_exists</methodname>
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
</methodsynopsis>
<para>
Checks the list of defined functions, both built-in (internal) and
user-defined, for <parameter>function_name</parameter>. &return.success;
</para>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
if (function_exists('imap_open')) {
@ -30,24 +28,24 @@ if (function_exists('imap_open')) {
}
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
Note that a function name may exist even if the function itself
is unusable due to configuration or compiling options (with the
<link linkend="ref.image">image</link> functions being an example).
Also note that <function>function_exists</function> will return
&false; for constructs, such as <function>include_once</function>
and <function>echo</function>.
</para>
<para>
See also <function>method_exists</function>,
<function>is_callable</function> and
<function>get_defined_functions</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
<para>
Note that a function name may exist even if the function itself
is unusable due to configuration or compiling options (with the
<link linkend="ref.image">image</link> functions being an example).
Also note that <function>function_exists</function> will return
&false; for constructs, such as <function>include_once</function>
and <function>echo</function>.
</para>
<para>
See also <function>method_exists</function>,
<function>is_callable</function> and
<function>get_defined_functions</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,32 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.6 -->
<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>
<methodsynopsis>
<type>array</type><methodname>get_defined_functions</methodname>
<void/>
</methodsynopsis>
<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).
</para>
<para>
<informalexample>
<programlisting role="php">
<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>
<methodsynopsis>
<type>array</type><methodname>get_defined_functions</methodname>
<void/>
</methodsynopsis>
<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).
</para>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function myrow($id, $data)
function myrow($id, $data)
{
return "<tr><th>$id</th><td>$data</td></tr>\n";
}
@ -36,11 +34,11 @@ $arr = get_defined_functions();
print_r($arr);
?>
]]>
</programlisting>
<para>
Will output something along the lines of:
</para>
<screen>
</programlisting>
<para>
Will output something along the lines of:
</para>
<screen>
<![CDATA[
Array
(
@ -65,17 +63,17 @@ Array
)
]]>
</screen>
</informalexample>
</para>
<para>
See also
<function>function_exists</function>,
<function>get_defined_vars</function> and
<function>get_defined_constants</function>.
</para>
</refsect1>
</refentry>
</screen>
</informalexample>
</para>
<para>
See also
<function>function_exists</function>,
<function>get_defined_vars</function> and
<function>get_defined_constants</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,82 +1,80 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<!-- $Revision: 1.14 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 -->
<refentry id="function.register-shutdown-function">
<refnamediv>
<refname>register_shutdown_function</refname>
<refpurpose>
Register a function for execution on shutdown
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>register_shutdown_function</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<simpara>
Registers the function named by <parameter>function</parameter> to be
executed when script processing is complete.
</simpara>
<para>
Multiple calls to <function>register_shutdown_function</function> can be
made, and each will be called in the same order as they were registered.
If you call <function>exit</function> within one registered shutdown
function, processing will stop completely and no other registered
shutdown functions will be called.
</para>
<para>
In PHP 4.0.6 and earlier under Apache,
the registered shutdown functions are called after the request has been
completed (including sending any output buffers), so it is not possible
to send output to the browser using <function>echo</function> or
<function>print</function>, or retrieve the contents of any output
buffers using <function>ob_get_contents</function>.
Since PHP 4.1, the shutdown functions are called as the part of the
request so that it's possible to send the output from them. There is
currently no way to process the data with output buffering functions in
the shutdown function.
Shutdown function is called after closing all opened output buffers thus,
for example, its output will not be compressed if <link
linkend="ini.zlib.output-compression">zlib.output_compression</link> is
enabled.
</para>
<para>
As of PHP 4, it is possible to pass parameters to the shutdown function by
passing additional parameters to
<function>register_shutdown_function</function>.
</para>
<note>
<para>
Typically undefined functions cause fatal errors in PHP, but when the
<parameter>function</parameter> called with
<function>register_shutdown_function</function> is undefined, an error
of level <constant>E_WARNING</constant> is generated instead. Also,
for reasons internal to PHP, this error will refer to
<literal>Unknown</literal> at line #0.
</para>
</note>
<note>
<para>
Working directory of the script can change inside the shutdown function
under some web servers, e.g. Apache.
</para>
</note>
<note>
<para>
Shutdown function is called during the script shutdown so headers are
always already sent.
</para>
</note>
<para>
See also <link linkend="ini.auto-append-file">auto_append_file</link>,
<function>exit</function>, and the section on
<link linkend="features.connection-handling">connection handling</link>.
</para>
</refsect1>
</refentry>
<refentry id="function.register-shutdown-function">
<refnamediv>
<refname>register_shutdown_function</refname>
<refpurpose>Register a function for execution on shutdown</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>register_shutdown_function</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<simpara>
Registers the function named by <parameter>function</parameter> to be
executed when script processing is complete.
</simpara>
<para>
Multiple calls to <function>register_shutdown_function</function> can be
made, and each will be called in the same order as they were registered.
If you call <function>exit</function> within one registered shutdown
function, processing will stop completely and no other registered
shutdown functions will be called.
</para>
<para>
In PHP 4.0.6 and earlier under Apache,
the registered shutdown functions are called after the request has been
completed (including sending any output buffers), so it is not possible
to send output to the browser using <function>echo</function> or
<function>print</function>, or retrieve the contents of any output
buffers using <function>ob_get_contents</function>.
Since PHP 4.1, the shutdown functions are called as the part of the
request so that it's possible to send the output from them. There is
currently no way to process the data with output buffering functions in
the shutdown function.
Shutdown function is called after closing all opened output buffers thus,
for example, its output will not be compressed if <link
linkend="ini.zlib.output-compression">zlib.output_compression</link> is
enabled.
</para>
<para>
As of PHP 4, it is possible to pass parameters to the shutdown function by
passing additional parameters to
<function>register_shutdown_function</function>.
</para>
<note>
<para>
Typically undefined functions cause fatal errors in PHP, but when the
<parameter>function</parameter> called with
<function>register_shutdown_function</function> is undefined, an error
of level <constant>E_WARNING</constant> is generated instead. Also,
for reasons internal to PHP, this error will refer to
<literal>Unknown</literal> at line #0.
</para>
</note>
<note>
<para>
Working directory of the script can change inside the shutdown function
under some web servers, e.g. Apache.
</para>
</note>
<note>
<para>
Shutdown function is called during the script shutdown so headers are
always already sent.
</para>
</note>
<para>
See also <link linkend="ini.auto-append-file">auto_append_file</link>,
<function>exit</function>, and the section on
<link linkend="features.connection-handling">connection handling</link>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,32 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.12 -->
<refentry id="function.register-tick-function">
<refnamediv>
<refname>register_tick_function</refname>
<refpurpose>
Register a function for execution on each tick
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>register_tick_function</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<simpara>
Registers the function named by <parameter>func</parameter> to be
executed when a <link
linkend="control-structures.declare.ticks">tick</link> is
called. Also, you may pass an array consisting of an object and a
method as the <parameter>func</parameter>.
</simpara>
<para>
<example>
<title><function>register_tick_function</function> example</title>
<programlisting role="php">
<refentry id="function.register-tick-function">
<refnamediv>
<refname>register_tick_function</refname>
<refpurpose>Register a function for execution on each tick</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>register_tick_function</methodname>
<methodparam><type>callback</type><parameter>function</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<simpara>
Registers the function named by <parameter>func</parameter> to be
executed when a <link
linkend="control-structures.declare.ticks">tick</link> is
called. Also, you may pass an array consisting of an object and a
method as the <parameter>func</parameter>.
</simpara>
<para>
<example>
<title><function>register_tick_function</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// using a function as the callback
@ -37,22 +35,22 @@ $object = new my_class();
register_tick_function(array(&$object, 'my_method'), true);
?>
]]>
</programlisting>
</example>
</para>
<warning>
<simpara>
<function>register_tick_function</function> should not be used with
threaded web server modules. Ticks are not working in ZTS mode and may
crash your web server.
</simpara>
</warning>
<para>
See also <link linkend="control-structures.declare">declare</link> and
<function>unregister_tick_function</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<warning>
<simpara>
<function>register_tick_function</function> should not be used with
threaded web server modules. Ticks are not working in ZTS mode and may
crash your web server.
</simpara>
</warning>
<para>
See also <link linkend="control-structures.declare">declare</link> and
<function>unregister_tick_function</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,26 +1,25 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/funchand.xml, last change in rev 1.12 -->
<refentry id="function.unregister-tick-function">
<refnamediv>
<refname>unregister_tick_function</refname>
<refpurpose>
De-register a function for execution on each tick
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>unregister_tick_function</methodname>
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
</methodsynopsis>
<simpara>
De-registers the function named by <parameter>function_name</parameter> so it is
no longer executed when a <link
linkend="control-structures.declare">tick</link> is
called.</simpara>
</refsect1>
</refentry>
<refentry id="function.unregister-tick-function">
<refnamediv>
<refname>unregister_tick_function</refname>
<refpurpose>De-register a function for execution on each tick</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>unregister_tick_function</methodname>
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
</methodsynopsis>
<simpara>
De-registers the function named by <parameter>function_name</parameter> so it is
no longer executed when a <link
linkend="control-structures.declare">tick</link> is
called.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: