Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher une fonction PHP

Working with Arrays

Arrays are stored in HashTable strucures, and have the zval type IS_ARRAY. The API functions for creating, destroying and manipulating these structures as variables are documented here and can be found in Zend/zend_API.h

HashTable as Variable API
Prototype Description
void array_init(zval* pzval) initializes the variable as a HashTable, setting type and appropriate destructor function for the HashTable
void array_init_size(zval* pzval) initializes the variable as array_init with a minimum of size buckets

Note:

Do not squint too hard looking for array_destroy: to destroy a variable array you should call zval_ptr_dtor on the variable, if there are no other references to the variable it will result in the array being destroyed.

Indexed Arrays API
Prototype
int add_index_long(zval* pzval, ulong index, long value)
int add_index_null(zval* pzval, ulong index)
int add_index_bool(zval* pzval, ulong index, zend_bool value)
int add_index_bool(zval* pzval, ulong index, zend_bool value)
int add_index_resource(zval* pzval, ulong index, uint value)
int add_index_double(zval* pzval, ulong index, double value)
int add_index_string(zval* pzval, ulong index, char* string, zend_bool duplicate)
int add_index_stringl(zval* pzval, ulong index, char* string, uint length, zend_bool duplicate)
int add_index_zval(zval* pzval, ulong index, zval* value)
int add_next_index_long(zval* pzval, long value)
int add_next_index_null(zval* pzval)
int add_next_index_bool(zval* pzval, zend_bool value)
int add_next_index_resource(zval* pzval, uint value)
int add_next_index_double(zval* pzval, double value)
int add_next_index_string(zval* pzval, const char* string, zend_bool dulpicate)
int add_next_index_stringl(zval* pzval, const char* string, uint length, zend_bool duplicate)
int add_next_index_zval(zval* pzval, zval* value)
Associative Arrays API
Prototype
int add_assoc_long(zval* pzval, const char* key, long value)
int add_assoc_long_ex(zval* pzval, const char* key, uint klen, long value)
int add_assoc_null(zval* pzval, const char* key)
int add_assoc_null_ex(zval* pzval, const char* key, uint klen)
int add_assoc_bool(zval* pzval, const char* key, zend_bool value)
int add_assoc_bool(zval* pzval, const char* key, zend_bool value)
int add_assoc_bool_ex(zval* pzval, const char* key, uint klen, zend_bool value)
int add_assoc_resource(zval* pzval, const char* key, uint value)
int add_assoc_resource_ex(zval* pzval, const char* key, uint klen, uint value)
int add_assoc_double(zval* pzval, const char* key, double value)
int add_assoc_double_ex(zval* pzval, const char* key, uint klen, double value)
int add_assoc_string(zval* pzval, const char* key, const char* value)
int add_assoc_string_ex(zval* pzval, const char* key, uint klen, const char* value)
int add_assoc_stringl(zval* pzval, const char* key, const char* value, uint vlen, zend_bool duplicate)
int add_assoc_stringl_ex(zval* pzval, const char* key, uint klen, const char* value, uint vlen, zend_bool duplicate)
int add_assoc_zval(zval* pzval, const char* key, zval* value)
int add_assoc_zval_ex(zval* pzval, const char* key, uint klen, zval* value)

Note:

add_*_string functions that accept a parameter named duplicate, will duplicate the string with estrndup when duplicate is true

Note:

add_*_zval functions do not adjust the refcount of the value parameter

To perform more advanced operations on array variables we must use the HashTable API directly.

Zoek een PHP-functie

Vertaling niet beschikbaar

De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.

Als je de moed voelt, kun je je vertaling aanbieden ;-)

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-internals2.variables.arrays.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : http://php.net

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut