CM2 Flashcards

1
Q

Comment s’écrit un tableau ?

A

array( “…” , “…” , “…” )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Structure des tableaux associatifs

A

array( “clé” => “élément” )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

deux façons d’écrire un tableau

A

$tab = array (“…” => “…”)
OU
$tab = []
$tab[12] = “…” (soit rédiger chaque clé séparément)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Combiner les tableaux

A

array([ …, …, …] , [ …, …, …,])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Parcourir un tableau

A

for ($k=0; $k < sizeof($tab); $k++) { … }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Boucle foreach

A

foreach ($tab as $val) { …}
OU
foreach ($tab as $key => $val) {…}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Que représente $val dans une boucle foreach

A

toutes les val stockés dans le tableau

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Exemple pour foreach avec $key

A

foreach ($tab as $key => $val) {echo $key. “=>” . $val . “ ( “.$tab[$key].” ) “ }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly