1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-07-31 12:00:34 +02:00

Merge pull request #1638 from xssc/patch-1

[php/en] Added variable amount of parameters as of php 5.6+
This commit is contained in:
Adam Bard
2015-10-19 14:30:28 +08:00

View File

@@ -452,6 +452,16 @@ function parameters() {
parameters('Hello', 'World'); // Hello | 0 - Hello | 1 - World |
// Since PHP 5.6 you can get a variable number of arguments
function variable($word, ...$list) {
echo $word . " || ";
foreach ($list as $item) {
echo $item . ' | ';
}
}
variable("Separate", "Hello", "World") // Separate || Hello | World |
/********************************
* Includes
*/