Meine assoziatives Array:Wie durchläuft man ein assoziatives Array und bekommt den Schlüssel?
$arr = array(
1 => "Value1",
2 => "Value2",
10 => "Value10"
);
Verwendung des folgenden Codes wird $v
mit $arr
's
foreach($arr as $v){
echo($v); // Value1, Value2, Value10
}
Werte Wie erhalte ich $arr
' gefüllt s Tasten statt?
foreach(.....){
echo($k); // 1, 2, 10
}
By the way, sind Sie Kommas in dem Feld fehlt. –
Letztes Komma ist optional, nicht wahr? –