| |
| * Link führt ins Internet |
|
| |
Befehl | Version | Beschreibung | Beispiel 1 | Ausgabe 1 | Beispiel 2 | Ausgabe 2 |
Befehl
| mixed key ( array array ) |
Version
Beschreibung
Die Funktion key() liefert den Schlüssel des aktuellen Elements innerhalb des
Arrays array. Ist das Array kein Assoziativarray, wird die ID des aktuellen
Elements zurückgegeben (0,1,2,3,4,.....,n ).
Siehe auch:
. current()
. next() |
Beispiel 1
<?PHP
$array =array("Script1"=>"PHP","Script2"=>"ASP");
for($x=0;$x<sizeof($array);$x++) {
echo key($array)." : ".current($array) . "\n";
next($array);
}
?>
|
Ausgabe 1
Script1 : PHP
Script2 : ASP
|
Beispiel 2
<?PHP
$array =array("PHP","ASP","Perl");
for($x=0;$x<sizeof($array);$x++) {
echo key($array)." : ".current($array) . "\n";
next($array);
}
?>
|
Ausgabe 2
|
|
|
|
|
|
|