Reputation: 749
What is this syntax I've seen some documentations applying, for example:
Sizzle( String selector[, DOMNode context[, Array results]] )
set_userdata($data[, $value = NULL])
Upvotes: 5
Views: 142
Reputation: 470
Those parentheses show that those parameters are optional in syntax. This examples aren't code lines, but syntax.
Valid code lines:
Sizzle(selector, context, results);
Sizzle(selector, context);
Sizzle(selector);
set_userdata($data, $value);
set_userdata($data);
But, if we take a look at @taxicala answer we have another situation
foo($param [, $param2 = NULL, $param3 = 1])
Valid code lines are
foo($param, $param2, $param3)
foo($param)
but not
foo($param, $param2)
Upvotes: 1
Reputation: 21759
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.
Upvotes: 6