数组(Working with Arrays)
函数名 |
---|
phalcon_array_isset |
phalcon_array_fetch |
phalcon_array_isset_fetch |
phalcon_array_update |
phalcon_array_append |
phalcon_array_unset |
Mixing both string and number indexes:
- // Let's create the following array using the Phalcon API
- // $fruits = array(1, null, false, "some string", 15.20, "my-index" => "another string");
- add_next_index_long(&fruits, 1);
- add_next_index_null(&fruits);
- add_next_index_bool(&fruits, 0);
- add_next_index_stringl(&fruits, SL("some string"));
- add_next_index_double(&fruits, 15.2);
- add_assoc_stringl_ex(&fruits, SL("my-index")+1, SL("another string"));
- // Updating an existing index $fruits[2] = "other value";
- phalcon_array_update_long_string(&fruits, 2, SL("other value"), PH_SEPARATE);
- // Removing an existing index unset($fruits[1]);
- phalcon_array_unset_long(fruits, 1);
- phalcon_array_unset_string(fruits, SL("my-index")+1);