From:             burg1 at gmx dot net
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  "Function arguments", section "Variable-length argument 
lists": give examples

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 bug report at http://bugs.php.net/?id=40569&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40569&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40569&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40569&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40569&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40569&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40569&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40569&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40569&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40569&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40569&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40569&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40569&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40569&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40569&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40569&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40569&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40569&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40569&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40569&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40569&r=mysqlcfg

Reply via email to