ID: 40569
Updated by: [EMAIL PROTECTED]
Reported By: burg1 at gmx dot net
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
PHP Version: Irrelevant
New Comment:
Examples are on the func_*_arg* pages which are linked from this
section.
Previous Comments:
------------------------------------------------------------------------
[2007-02-20 23:16:02] burg1 at gmx dot net
Description:
------------
Please include examples on how to define (and call) functions with a
variable number of arguments:
Example 17.11. Define a function with variable number of arguments:
function test() {
echo func_get_arg(0);
}
test('hello'); // prints 'hello'
Example 17.12. Other method to define a function with optional second
argument
function test($foo, $bar=null) {
echo $bar;
}
test('one','two'); // prints 'two'
test('one'); // prints nothing
Example 17.13. Wrong way to define a function with optional second
argument
function test($foo, $bar) {
...
}
test('one'); // gives warning, that argument 2 is missing for test()
Why am I asking for this?
Because the current explanation "No special syntax is required" is not
very descriptive. So my first guess was the wrong way shown in Example
17.13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40569&edit=1