note 5288 modified in functions.arguments by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 19:36:04 +0000 |
| Subject: | note 5288 modified in functions.arguments by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25258@lists.php.net to get a copy of this message | ||
One interesting thing I've noticed:
function foo() { // accepts any number of arguments
bar()
}
function bar($x,$y) { // same
print("$x $y");
}
foo("one","two);
OUPUT: "one two"
That is, PHP will automatically pass all the variables passed to foo() into bar() if you don't
pass them explicitly. I'm not sure how far this extends (i.e. if you pass just one variable,
will the rest still get tacked on? etc), but it's interesting, and undocumented.
--was--
One interesting thing I've noticed:
<pre>
function foo() { // accepts any number of arguments
bar()
}
function bar($x,$y) { // same
print("$x $y");
}
foo("one","two);
OUPUT: "one two"
</pre>
That is, PHP will automatically pass all the variables passed to foo() into bar() if you don't
pass them explicitly. I'm not sure how far this extends (i.e. if you pass just one variable,
will the rest still get tacked on? etc), but it's interesting, and undocumented.
http://www.php.net/manual/en/functions.arguments.php