Dealing with a Variable Number of Arguments/Optional Parameters




First, the number of arguments is checked to make sure that it's in the accepted range. After that, zend_get_parameters_array_ex() is used to fill parameter_array with valid pointers to the argument values.

A very clever implementation of this can be found in the code handling PHP' s fsockopen( ) located in ext / standard / fsock.c , as shown in Voorbeeld 32-1 .

Voorbeeld 32-1 .