Writing a PHP Extension |
|
2024-11-25 |
|
|
10 |
|
|
To do real parameter handling, use the zend_parse_parameters()
function.
You can make it an optional argument by putting a "|" in the
argument format string. Like this:
Here are all the possible modifiers in the argument format string:
'l' long (integer)
'd' double (floating point)
's' string
'b' boolean
'r' resource
'a' array
'o' any object
'O' specific object
'z' zval
'Z' zval-ref
'|' next arg is optional
'/' arg is separated if not a reference
'!' next arg returns null if type IS_NULL
So, for example, a function that takes a string, an integer, and array and an
optional resource would look like this: