my question is (I hope not a silly one) why in the description the the square brackets started before the comma I expect it to be
string basename ( string $path, [string $suffix ] )
and not
string basename ( string $path [, string $suffix ] )
Because the comma is needed only if it is added the other argument (in square brackets), otherwise no need to add comma.
So, the comma comes with that argument, which is optional.
Should be read as: “Needs 1 string. May have a second string, followed by 0 or more strings, and then a number.”
The function may have:
1 parameter (string imrequired) function1(“Haha”)
3 parameters (string imrequired, string imnot, and int anumber) function1(“Haha”,“Nope”,3)
4+ paramters (string imrequired, string imnot, 1 or more string $…, and int anumber) function1(“AString”,“BString”,“CString”,9000)
If the comma were outside the , it would be required, and thus the syntax would be function1(“Haha”,) , which makes no sense.