next up previous contents
Next: php_array::add_index Up: Function Reference Previous: php_array::add   Contents

php_array::add_assoc

#include "php_arr.h"

void 
php_array::add_assoc(char *argspec, ...);

Description: Add each pair of values described by argspec and included as subsequent arguments to the php_array as key value pairs. This is logically equivalent to taking each key-value pair passed in and calling $php_array[$key] = $value; in PHP. Since this function adds associative keys to the array, all even values in argspec must be specified as string values (beginning with the 0th index). If a key provided as an argument already exists in the array, its value will be overwritten with the new value provided.

Errors: It is an error for argspec to be undefined. It is an error for the number of values described in argspec to differ from the number of arguments provided thereafter. It is an error for an odd number of values to be passed in. It is an error for the types of additional arguments to differ from their description in argspec (see Table 1 on page [*] for details). It is an error for any even values to have type other than char * since associative keys must be strings. Any errors during execution may result in fewer values than expected being inserted into the array.


next up previous contents
Next: php_array::add_index Up: Function Reference Previous: php_array::add   Contents
Andrew Bosworth 2008-03-24