Functions
Function are defined using the following syntax:
rcaron
func Name($param, $optParam = 1) {// ...return 1}
rcaron
func Name($param, $optParam = 1) {// ...return 1}
The func
keyword is followed by the name of the function, a list of parameters, and a block of code. The parameter param
above is required, while optParam
is optional and has a default value of 1
. The return
keyword is used to return a value from the function.
A function can be called using both the call-like and keyword plain call call types.