diff --git a/reference/funchand/functions/call-user-func-array.xml b/reference/funchand/functions/call-user-func-array.xml index 081bfd98ec..c61f2b7039 100644 --- a/reference/funchand/functions/call-user-func-array.xml +++ b/reference/funchand/functions/call-user-func-array.xml @@ -1,5 +1,5 @@ - + call_user_func_array @@ -69,8 +69,8 @@ function debug($var, $val) 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 @@ call_user_func_array('debug', array("_POST", $_POST)); ?> ]]> + &example.outputs.similar; + + + <function>call_user_func_array</function> using namespace name @@ -95,15 +100,20 @@ class Foo { // 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! ?> ]]> + &example.outputs.similar; + + + Using lambda function @@ -116,11 +126,16 @@ $func = function($arg1, $arg2) { }; var_dump(call_user_func_array($func, array(2, 4))); /* As of PHP 5.3.0 */ -// int(8) ?> ]]> + &example.outputs; + + + diff --git a/reference/funchand/functions/call-user-func.xml b/reference/funchand/functions/call-user-func.xml index 46213dc43a..fa4e6ceeb9 100644 --- a/reference/funchand/functions/call-user-func.xml +++ b/reference/funchand/functions/call-user-func.xml @@ -1,5 +1,5 @@ - + call_user_func @@ -46,10 +46,12 @@ Note that the parameters for call_user_func are not passed by reference. - + + <function>call_user_func</function> example and references ]]> - + &example.outputs; + + + + @@ -90,13 +99,20 @@ echo $a; // 1 ]]> + &example.outputs; + + + <function>call_user_func</function> using namespace name @@ -113,16 +129,21 @@ class Foo { } 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! ?> ]]> + &example.outputs; + + + - Using a class method + Using a class method with <function>call_user_func</function> ]]> + &example.outputs; + + + - Using lambda function + Using lambda function with <function>call_user_func</function> ]]> + &example.outputs; + + + diff --git a/reference/funchand/functions/func-get-args.xml b/reference/funchand/functions/func-get-args.xml index 4970f24989..e02957eadb 100644 --- a/reference/funchand/functions/func-get-args.xml +++ b/reference/funchand/functions/func-get-args.xml @@ -1,5 +1,5 @@ - + func_get_args @@ -86,6 +86,16 @@ foo(1, 2, 3); ?> ]]> + &example.outputs; + + +Second argument is: 2
+Argument 0 is: 1
+Argument 1 is: 2
+Argument 2 is: 3
+]]> +
diff --git a/reference/funchand/functions/func-num-args.xml b/reference/funchand/functions/func-num-args.xml index aa9b7d9ab1..50e358dc7d 100644 --- a/reference/funchand/functions/func-num-args.xml +++ b/reference/funchand/functions/func-num-args.xml @@ -1,5 +1,5 @@ - + func_num_args @@ -75,10 +75,16 @@ function foo() echo "Number of arguments: $numargs\n"; } -foo(1, 2, 3); // Prints 'Number of arguments: 3' +foo(1, 2, 3); ?> ]]> + &example.outputs; + + +