Choose:Python or Php
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
Aktueller Buchtipp
Franzis Verlag
ca. 600
Seiten
EUR 44,95