Toutes les fonctions pour les tableaux.
array(0) {
}
array(4) {
[0]=>
string(5) "texte"
[1]=>
int(15)
[2]=>
bool(true)
[3]=>
float(8.6500000000000003552713678800500929355621337890625)
}
15
Ajoute un élément à la fin du tableau
array(5) {
[0]=>
string(5) "texte"
[1]=>
int(15)
[2]=>
bool(true)
[3]=>
float(8.6500000000000003552713678800500929355621337890625)
[4]=>
string(3) "fin"
}
Une autre façon d'ajouter un élément à la fin du tableau
array(6) {
[0]=>
string(5) "texte"
[1]=>
int(15)
[2]=>
bool(true)
[3]=>
float(8.6500000000000003552713678800500929355621337890625)
[4]=>
string(3) "fin"
[5]=>
string(28) "cette fois c'est bien la fin"
}
Ajoute un élément au début du tableau
array(7) {
[0]=>
string(6) "début"
[1]=>
string(5) "texte"
[2]=>
int(15)
[3]=>
bool(true)
[4]=>
float(8.6500000000000003552713678800500929355621337890625)
[5]=>
string(3) "fin"
[6]=>
string(28) "cette fois c'est bien la fin"
}
Supprime le dernier élément du tableau
array(6) {
[0]=>
string(6) "début"
[1]=>
string(5) "texte"
[2]=>
int(15)
[3]=>
bool(true)
[4]=>
float(8.6500000000000003552713678800500929355621337890625)
[5]=>
string(3) "fin"
}
Supprime le premier élément du tableau
array(5) {
[0]=>
string(5) "texte"
[1]=>
int(15)
[2]=>
bool(true)
[3]=>
float(8.6500000000000003552713678800500929355621337890625)
[4]=>
string(3) "fin"
}
Tableau avec une clé et une valeur
array(3) {
["nom"]=>
string(14) "Nom de famille"
["prenom"]=>
string(7) "Prénom"
["age"]=>
int(18)
}
Nom de famille Prénom.
Il a 18 ans.
Tableau de tableau...
array(3) {
["nom"]=>
string(14) "Nom de famille"
["prenom"]=>
string(7) "Prénom"
["adresse"]=>
array(4) {
["rue"]=>
string(18) "Rue de la Victoire"
["numero"]=>
int(50)
["codePostal"]=>
int(1100)
["commune"]=>
string(9) "Bruxelles"
}
}
5
banane
poire
pomme
citron
prune
1 : banane
2 : poire
3 : pomme
4 : citron
5 : prune
prune
Banane, poire, pomme, citron, prune.