PHPverse 2025

Voting

: max(two, eight)?
(Example: nine)

The Note You're Voting On

OpenTechnologist
13 years ago
please note that optional parameters are not seen/passed by func_get_args(), as well as func_get_arg().

ex:

<?php
function testfunc($optional = 'this argument is optional..') {
$args = func_get_args();
var_dump($args);
echo
$optional;
}
?>

test case #1:
testfunc('argument no longer optional..');

result for #1:
array(1) {
[0]=> string(20) "argument no longer optional.."
}
argument no longer optional..

test case #2:
testfunc('argument no longer optional..','this is an extra argument');

result for #2:
array(2) {
[0]=> string(29) "argument no longer optional.."
[1]=> string(25) "this is an extra argument"
}
argument no longer optional..

test case #3: -- RESULTS IN AN EMPTY ARRAY
testfunc();

result for #3:
array(0) {
}
this argument is optional..

<< Back to user notes page

To Top