summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--php.html.markdown10
1 files changed, 10 insertions, 0 deletions
diff --git a/php.html.markdown b/php.html.markdown
index 5bc2ddce..e7b57b4b 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -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
*/