Added variable amount of parameters as of php 5.6+

This commit is contained in:
Sawyer Charles 2015-10-18 17:46:23 -05:00
parent ba5f3ebc11
commit ed4ac31d97

View File

@ -445,6 +445,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
*/