Question
In the PHP Official Documentation I found somewhere declarations like this:
public int save ( string $filename [, int $options ] )
and like this:
public mixed load ( string $filename [, int $options = 0 ] )
What's the difference between both, on the $options
argument?
The second one I'm sure that has the $options
argument set to 0 (when I don't specify it).
But the first one? Isn't it saying that the method has 2 mandatory arguments? (so whats the square brackets for?).
Example
I'm trying to override this:
public bool schemaValidate ( string $filename [, int $flags ] )
(fingerprint pasted from schemaValidate() PHP documentation)
but if I declare the second argument $flags
, then I get a
SchemaValidate() should be compatible with DOMDocument::schemaValidate($filename)
If I remove the declaration of $flags
everything works (like if I were in < PHP 5.5.2)
While I run PHP 5.5.9 and $flags
has been introduced in schemaValidate()
constructor from PHP 5.5.2, why do I get the incompatibly problem?
I don't get if the PHP Documentation is trustable or if I should check somewhere else for the right function fingerprint, when I want to override native methods.
I tried to have a look at the source code, but the function is merely an alias to a C function.