cvs: phpdoc /en/reference/funchand/functions call-user-func-array.xml call-user-func.xml func-get-args.xml func-num-args.xml
| From: | Damien Seguy | Date: | Thu, 02 Jul 2009 21:52:02 +0000 |
| Subject: | cvs: phpdoc /en/reference/funchand/functions call-user-func-array.xml call-user-func.xml func-get-args.xml func-num-args.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-4315@lists.php.net to get a copy of this message | ||
dams Thu Jul 2 21:52:02 2009 UTC
Modified files:
/phpdoc/en/reference/funchand/functions call-user-func-array.xml
call-user-func.xml
func-get-args.xml
func-num-args.xml
Log:
upgrade examples
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/funchand/functions/call-user-func-array.xml?r1=1.22&r2=1.23&diff_format=u
Index: phpdoc/en/reference/funchand/functions/call-user-func-array.xml
diff -u phpdoc/en/reference/funchand/functions/call-user-func-array.xml:1.22
phpdoc/en/reference/funchand/functions/call-user-func-array.xml:1.23
--- phpdoc/en/reference/funchand/functions/call-user-func-array.xml:1.22 Thu Apr 2 01:51:02 2009
+++ phpdoc/en/reference/funchand/functions/call-user-func-array.xml Thu Jul 2 21:52:02 2009
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.22 $ -->
+<!-- $Revision: 1.23 $ -->
<refentry xml:id="function.call-user-func-array" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>call_user_func_array</refname>
@@ -69,8 +69,8 @@
echo "***\n";
}
-$c = mysql_connect();
-$host = $_SERVER["SERVER_NAME"];
+$c = new StdClass();
+$host = $_SERVER["PHP_SELF"];
call_user_func_array('debug', array("host", $host));
call_user_func_array('debug', array("c", $c));
@@ -78,6 +78,11 @@
?>
]]>
</programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+]]>
+ </screen>
</example>
<example>
<title><function>call_user_func_array</function> using namespace
name</title>
@@ -95,15 +100,20 @@
// As of PHP 5.3.0
call_user_func_array(__NAMESPACE__ .'\Foo::test', array('Hannes'));
-// Hello Hannes!
// As of PHP 5.3.0
call_user_func_array(array(__NAMESPACE__ .'\Foo', 'test'),
array('Philip'));
-// Hello Philip!
?>
]]>
</programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+Hello Hannes!
+Hello Philip!
+]]>
+ </screen>
</example>
<example>
<title>Using lambda function</title>
@@ -116,11 +126,16 @@
};
var_dump(call_user_func_array($func, array(2, 4))); /* As of PHP 5.3.0 */
-// int(8)
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+int(8)
+]]>
+ </screen>
</example>
</para>
</refsect1>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/funchand/functions/call-user-func.xml?r1=1.22&r2=1.23&diff_format=u
Index: phpdoc/en/reference/funchand/functions/call-user-func.xml
diff -u phpdoc/en/reference/funchand/functions/call-user-func.xml:1.22
phpdoc/en/reference/funchand/functions/call-user-func.xml:1.23
--- phpdoc/en/reference/funchand/functions/call-user-func.xml:1.22 Mon May 4 22:20:08 2009
+++ phpdoc/en/reference/funchand/functions/call-user-func.xml Thu Jul 2 21:52:02 2009
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.22 $ -->
+<!-- $Revision: 1.23 $ -->
<refentry xml:id="function.call-user-func" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>call_user_func</refname>
@@ -46,10 +46,12 @@
<para>
Note that the parameters for <function>call_user_func</function> are
not passed by reference.
- <informalexample>
+ <example>
+ <title><function>call_user_func</function> example and
references</title>
<programlisting role="php">
<![CDATA[
<?php
+error_reporting(E_ALL);
function increment(&$var)
{
$var++;
@@ -57,14 +59,21 @@
$a = 0;
call_user_func('increment', $a);
-echo $a; // 0
+echo $a."\n";
-call_user_func_array('increment', array(&$a)); // You can use this instead
-echo $a; // 1
+call_user_func_array('increment', array(&$a)); // You can use this instead before PHP
5.3
+echo $a."\n";
?>
]]>
</programlisting>
- </informalexample>
+ &example.outputs;
+ <screen>
+<![CDATA[
+0
+1
+]]>
+ </screen>
+ </example>
</para>
</note>
</listitem>
@@ -90,13 +99,20 @@
<?php
function barber($type)
{
- echo "You wanted a $type haircut, no problem";
+ echo "You wanted a $type haircut, no problem\n";
}
call_user_func('barber', "mushroom");
call_user_func('barber', "shave");
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+You wanted a mushroom haircut, no problem
+You wanted a shave haircut, no problem
+]]>
+ </screen>
</example>
<example>
<title><function>call_user_func</function> using namespace name</title>
@@ -113,16 +129,21 @@
}
call_user_func(__NAMESPACE__ .'\Foo::test'); // As of PHP 5.3.0
-// Hello world!
call_user_func(array(__NAMESPACE__ .'\Foo', 'test')); // As of PHP 5.3.0
-// Hello world!
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Hello world!
+Hello world!
+]]>
+ </screen>
</example>
<example>
- <title>Using a class method</title>
+ <title>Using a class method with
<function>call_user_func</function></title>
<programlisting role="php">
<![CDATA[
<?php
@@ -146,19 +167,30 @@
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Hello!
+Hello!
+Hello!
+]]>
+ </screen>
</example>
<example>
- <title>Using lambda function</title>
+ <title>Using lambda function with
<function>call_user_func</function></title>
<programlisting role="php">
<![CDATA[
<?php
-
call_user_func(function($arg) { print "[$arg]\n"; }, 'test'); /* As of PHP
5.3.0 */
-// [test]
-
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+[test]
+]]>
+ </screen>
</example>
</para>
</refsect1>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/funchand/functions/func-get-args.xml?r1=1.14&r2=1.15&diff_format=u
Index: phpdoc/en/reference/funchand/functions/func-get-args.xml
diff -u phpdoc/en/reference/funchand/functions/func-get-args.xml:1.14
phpdoc/en/reference/funchand/functions/func-get-args.xml:1.15
--- phpdoc/en/reference/funchand/functions/func-get-args.xml:1.14 Mon Jun 9 11:21:12 2008
+++ phpdoc/en/reference/funchand/functions/func-get-args.xml Thu Jul 2 21:52:02 2009
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.14 $ -->
+<!-- $Revision: 1.15 $ -->
<refentry xml:id="function.func-get-args" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>func_get_args</refname>
@@ -86,6 +86,16 @@
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Number of arguments: 3<br />
+Second argument is: 2<br />
+Argument 0 is: 1<br />
+Argument 1 is: 2<br />
+Argument 2 is: 3<br />
+]]>
+ </screen>
</example>
</para>
</refsect1>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/funchand/functions/func-num-args.xml?r1=1.11&r2=1.12&diff_format=u
Index: phpdoc/en/reference/funchand/functions/func-num-args.xml
diff -u phpdoc/en/reference/funchand/functions/func-num-args.xml:1.11
phpdoc/en/reference/funchand/functions/func-num-args.xml:1.12
--- phpdoc/en/reference/funchand/functions/func-num-args.xml:1.11 Mon Jun 9 11:21:12 2008
+++ phpdoc/en/reference/funchand/functions/func-num-args.xml Thu Jul 2 21:52:02 2009
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.11 $ -->
+<!-- $Revision: 1.12 $ -->
<refentry xml:id="function.func-num-args" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>func_num_args</refname>
@@ -75,10 +75,16 @@
echo "Number of arguments: $numargs\n";
}
-foo(1, 2, 3); // Prints 'Number of arguments: 3'
+foo(1, 2, 3);
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Number of arguments: 3
+]]>
+ </screen>
</example>
</para>
</refsect1>