| Start |
|---|
| Variable-length argument lists PHP 5.6 introduced variable-length argument lists (a.k.a. varargs, variadic arguments), using the Type names can be added in front of the The Output: On the other hand, an array (or Output: Compare with this snippet without using Output: Therefore, redirect functions for variadic functions can now be easily made, for example: Apart from arrays, If the iterator iterates infinitely, for example: Different versions of PHP behave differently:
Note: HHVM (v3.10 - v3.12) does not support unpacking |
| Optional Parameters Functions can have optional parameters, for example: |
| Passing Arguments by Reference Function arguments can be passed "By Reference", allowing the function to modify the variable used outside the function: Object arguments are always passed by reference: To avoid implicit passing an object by reference, you should Passing by reference can also be used as an alternative way to return parameters. For example, the This method actually aims to return the address and port of the peer, but since there are two values to return, it chooses to use reference parameters instead. It can be called like this: The variables
|
| Basic Function Usage A basic function is defined and executed like this: |
| Function Scope Variables inside functions is inside a local scope like this Syntax
|
Read Article
https://develop.horje.com/learn/1434/reference