Bonjour;
J'ai tour petit souci, je réecris un script et transforme une boucle for en foreach...

Voici le code original...

[CODE]
$tb .= "<tr".$this->getClassTag("tr").">\n";
// for($i=0;$i<count($this->tbdesigner);$i++) {
foreach ($this->data as $key => $value) {
$tb .= "<td".$this->getClassTag("td")."><span".$this->getClassTag("tbdesigner").">".$this->tbdesigner[$key]."</span></td>\n";
}
$tb .= "</tr>\n";
[CODE]

Mon souci est l'utilsation de => $value,$value qui n'est utilisé dans le code
Si je le supprime; je n'ai rien d'affiché....
J'ai pourtant relu la doc mais ne percute pas...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes:
 
foreach (array_expression as $value)
    statement
foreach (array_expression as $key => $value)
    statement
 
The first form loops over the array given by array_expression. On each iteration, the value of the current element is assigned to $value and the internal array pointer is advanced by one (so on the next iteration, you'll be looking at the next element).
 
The second form will additionally assign the current element's key to the $key variable on each iteration.
Ce n'est pas une question d'anglais mais... ne voit pas

Merci de m'éclairer...