note 54356 added to zend.arguments.access
| From: | josephmdaly at gmail dot com | Date: | Fri, 01 Jul 2005 10:26:22 +0000 |
| Subject: | note 54356 added to zend.arguments.access | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91252@lists.php.net to get a copy of this message | ||
Here is a quick example of how to read arrays passed as parameters:
int i;
/* data will be used to store one element on each iteration of a loop */
zval **data = NULL;
/* data_array is the array we are copying values into */
char **data_array = NULL;
/* Use zend_parse_parameters as you normally would with an 'a' in the type
string.
In this example it sets the variables data_arg and array_length
*/
data_array = emalloc(sizeof(char *) * array_length);
for (i = 0; i < array_length; i++) {
/* Get an element out of the hash table as a zval */
zend_hash_index_find(Z_ARRVAL_P(data_arg), i, (void **)&data);
/* Make sure the zval is a string */
convert_to_string(*data);
/* Convert the zval into a string and store it */
data_array[i] = Z_STRVAL_PP(data);
}
----
Manual Page -- http://www.php.net/manual/en/zend.arguments.access.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54356
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54356&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54356&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54356&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54356&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54356&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54356&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54356&report=yes
Search -- http://master.php.net/manage/user-notes.php