Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do some array parameters have a comma after opening parentheses?

What is this syntax I've seen some documentations applying, for example:

Jquery Sizzle

Sizzle( String selector[, DOMNode context[, Array results]] )

Codeiginiter 3

set_userdata($data[, $value = NULL])

like image 800
William Avatar asked Jun 19 '15 13:06

William


1 Answers

Basically, what this means, is that all parameters inside the [] are optional. You dont need to pass anything in order to make the function call work:

foo($param [, $param2 = NULL, $param3 = 1])

$param1 and $param2 are optional, $param is mandatory.

like image 191
taxicala Avatar answered Sep 19 '22 07:09

taxicala