| parrotcode: PHP Array | |
| Contents | Language Implementations | Pipp | 

src/pmc/phparray.pmc - PHP Array


void init()void init_pmc(PMC *p)p.
If p is a PHPArray,
its contents are copied directly.
If p is a PMC that provides a hash or array interface,
its contents are copied via the appropriate VTABLE functions.
In any other case,
an exception will be thrown.void destroy()void mark()INTVAL elements()void set_integer_keyed(PMC *key, INTVAL i_val)i_val in this PHPArray,
indexed by the Key PMC key.void set_integer_keyed_str (STRING *s_key, INTVAL i_val)i_val in this PHPArray,
indexed by the STRING s_key.void set_integer_keyed_int (INTVAL i_key, INTVAL i_val)i_val in this PHPArray,
indexed by the INTVAL i_key.void set_pmc_keyed(PMC *key, PMC *p_val)val in this PHPArray,
indexed by the Key PMC key.void set_pmc_keyed_str(STRING *s_key, PMC *val)val in this PHPArray,
indexed by the STRING s_key.void set_pmc_keyed_int(INTVAL i_key, PMC *val)val in this PHPArray,
indexed by the INTVAL i_key.void set_string_keyed(PMC *key, STRING *s_val)s_val in this PHPArray,
indexed by the Key PMC key.void set_string_keyed_str(STRING *s_key, STRING *s_val)s_val in this PHPArray,
indexed by the STRING s_key.void set_string_keyed_int(INTVAL i_key, STRING *s_val)s_val in this PHPArray,
indexed by the INTVAL i_key.void set_number_keyed(PMC *key, FLOATVAL f_val)f_val in this PHPArray,
indexed by the Key PMC key.void set_number_keyed_str(STRING *s_key, FLOATVAL f_val)f_val in this PHPArray,
indexed by the STRING s_key.void set_number_keyed_int(INTVAL i_key, FLOATVAL f_val)f_val in this PHPArray,
indexed by the INTVAL i_key.INTVAL get_integer_keyed(PMC *key)key.INTVAL get_integer_keyed_str(STRING *s_key)s_key.INTVAL get_integer_keyed_int(INTVAL i_key)i_key.PMC *get_pmc_keyed(PMC *key)key.PMC *get_pmc_keyed_str(STRING *s_key)s_key.PMC *get_pmc_keyed_int(INTVAL i_key)i_key.STRING *get_string_keyed(PMC *key)key.STRING *get_string_keyed_str(STRING *s_key)s_key.STRING *get_string_keyed_int(INTVAL i_key)i_key.FLOATVAL get_number_keyed(PMC *key)key.FLOATVAL get_number_keyed_str(STRING *s_key)s_key.FLOATVAL get_number_keyed_int(INTVAL i_key)i_key.INTVAL exists_keyed(PMC *key)key exists.INTVAL exists_keyed_str(STRING *s_key)s_key exists.INTVAL exists_keyed_int(INTVAL i_key)i_key exists.void delete_keyed(PMC *key)key,
delete it.
Otherwise do nothing.void delete_keyed_str(STRING *s_key)key,
delete it.
Otherwise do nothing.void delete_keyed_int(INTVAL i_key)key,
delete it.
Otherwise do nothing.void push_integer(INTVAL i)i to the end of this PHPArray.void push_pmc(PMC *p_val)p_val to the end of this PHPArray.void push_string(STRING *s_val)s_val to the end of this PHPArray.void push_float(FLOATVAL f_val)f_val to the end of this PHPArray.INTVAL pop_integer()PMC *pop_pmc()STRING *pop_string()FLOATVAL pop_float()void unshift_integer(INTVAL i_val)i_val to the beginning of this PHPArray.
i_val will be keyed by the INTVAL 0 and all other numerically indexed elements will be renumbered according to insertion order.void unshift_pmc(PMC *p_val)p_val to the beginning of this PHPArray.
p_val will be keyed by the INTVAL 0 and all other numerically indexed elements will be renumbered according to insertion order.void unshift_string(STRING *s_val)s_val to the beginning of this PHPArray.
s_val will be keyed by the INTVAL 0 and all other numerically indexed elements will be renumbered according to insertion order.void unshift_float(FLOATVAL f_val)f_val to the beginning of this PHPArray.
f_val will be keyed by the INTVAL 0 and all other numerically indexed elements will be renumbered according to insertion order.INTVAL shift_integer()PMC *shift_pmc()STRING *shift_string()FLOATVAL shift_float()STRING *name()STRING *get_string()INTVAL get_bool()void visit(visit_info *info()void freeze(visit_info *info()visit() has been called during the freeze process,
this VTABLE function is used to add additional information about the PHPArray to the visit_info struct.void thaw(visit_info *info()visit() is called during the thaw process,
this VTABLE function is used to initialize the empty PHPArray.void thawfinish(visit_info *info()visit() is called during the thaw process,
this VTABLE function is used to make any changes to the newly thawed PHPArray which could not be made during the thaw process.PMC *get_iter()iter opcode as follows: $P0 = new 'PhpArray'
 $P1 = iter $P0
PMC *clone()void assign_pmc(PMC *src)src is an aggregate PMC (i.e. one that does hash and/or array), use an Iterator to copy each key/value pair into this PHPArray. If src is a PHPArray, just make a clone.PMC *add(PMC *src, PMC *dest)SELF and src into dest. All values in dest are deleted. If the same key is in both src and SELF, the value from SELF will be used.PMC *i_add(PMC *src)src into SELF. If the same key is in both src and SELF, the value from SELF will be used.INTVAL is_equal(PMC *other)SELF and other contain the same key/value pairs and have the same number of elements. Order is not important.INTVAL is_equal_num(PMC *other)INTVAL is_equal_string(PMC *other)INTVAL is_same(PMC *other)SELF and other point to the same place in memory.INTVAL cmp(PMC *other)SELF to other. A PHPArray with fewer elements is always considered to be less than one with more elements. Two PHPArrays of the same size are comparable if they have the same keys. In this case, a > b if the first unequal value of a is greater, according to the internal ordering of a. This means it's possible for both a > b and b > a to be true.SELF is larger, cmp returns 1. If they're equal, cmp returns 0. If other is larger, cmp returns -1.SELF and the other PMC are not comparable, an exception is thrown. This is to allow the PHP implementation to return null for a comparison between two non-comparable PHPArrays.INTVAL cmp_num(PMC *other)INTVAL cmp_string(PMC *other)STRING *get_repr()get_repr(): {0: 4, 4: 323, 'foo': 9999999}

METHOD void next()next() function.METHOD void prev()prev() function.METHOD void reset()reset() function.METHOD void end()end() function.METHOD STRING *key()METHOD PMC *current()METHOD PMC *each()key and value are the key and value from this PhpArray. If the internal pointer does not point to a valid element, a PhpBoolean false will be returned.PMC *to_number()METHOD void sanity_check()
| 
                     | 
                
                     
                 |