note 40962 modified in zend.structure.function-block by gwynne
| From: | gwynne@php.net | Date: | Mon, 18 Jun 2007 17:56:14 +0000 |
| Subject: | note 40962 modified in zend.structure.function-block by gwynne | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127551@lists.php.net to get a copy of this message | ||
As a completion to k at ailis dot de :
According to ARG_SHOULD_BE_SENT_BY_REF macro in zend_compile.h, BYREF_FORCE_REST force the rest of
the arguments to be passed as ref.
The first byte have to be the index of BYREF_FORCE_REST in the array.
Means, if you have, 5 args, the first two ones are NOT passed as ref, and the 3 others are, you can
do :
static unsigned char rest_arguments_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
We can see a few things in this example :
* As k at ailis dot de said, the first byte is _NOT_ the number of args passed to the function.
* The argument corresponding to BYREF_FORCE_REST MUST be passed as a reference
* The others arguments MUST be passed as a reference
--was--
As a completion to k at ailis dot de :
According to ARG_SHOULD_BE_SENT_BY_REF macro in zend_compile.h, BYREF_FORCE_REST force the rest of
the arguments to be passed as ref.
The first byte have to be the index of BYREF_FORCE_REST in the array.
Means, if you have, 5 args, the first two ones are NOT passed as ref, and the 3 others are, you can
do :
static unsigned char rest_arguments_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
We can see a few things in this example :
* As k at ailis dot de said, the first byte is _NOT_ the number of args passed to the function.
* The argument corresponding to BYREF_FORCE_REST MUST be passed as a reference
* The others arguments MUST be passed as a reference
http://php.net/manual/en/zend.structure.function-block.php