This function, for example ...
int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] )
It takes the lines $pattern and $subject . However, what is [ ?
$pattern
$subject
[
Here's how the documentation for the function indicates arguments that are optional
This is an old convention from Unix systems. Usage reports :
On Unix-like platforms, usage reports tend to follow the same familiar with regular patterns. They often begin with "Usage:" (hence, possibly a name), a command followed by a list of arguments. To indicate optional arguments, square brackets are commonly used, and can also be used to group parameters that must be specified together. Exceptional parameters can be indicated by dividing them with vertical stripes within groups.Here is a detailed example based on the NetBSD style source code guide:Usage: program [-aDde] [-f | -g] [-n number] [-b b_arg | -c c_arg] req1 req2 [opt1 [opt2]]This would mean that "program" should be called with:parameters without operands: a, D, d, e (any of them can be omitted). Please note that in this case, some parameters are case sensitive.exclusive options: f, g (indicated by a vertical bar)parameters with operands: nexclusive options with operands: b, crequired arguments: req1, req2optional argument opt1, which can be used with or without opt2 (marked as optional in a group using another set of square brackets)optional argument opt2, which requires opt1
On Unix-like platforms, usage reports tend to follow the same familiar with regular patterns. They often begin with "Usage:" (hence, possibly a name), a command followed by a list of arguments. To indicate optional arguments, square brackets are commonly used, and can also be used to group parameters that must be specified together. Exceptional parameters can be indicated by dividing them with vertical stripes within groups.
Here is a detailed example based on the NetBSD style source code guide:
Usage: program [-aDde] [-f | -g] [-n number] [-b b_arg | -c c_arg] req1 req2 [opt1 [opt2]]
This would mean that "program" should be called with: