Rapide Advanced Adulte
   key   
Resultatskey   |   Contact

     Manuel PHP     
Partager
 
 
Partager
Partager

 

Table :

.array change key case
.array chunk
.array combine
.array count values
.array diff assoc
.array diff key
.array diff uassoc
.array diff ukey
.array diff
.array fill keys
.array fill
.array filter
.array flip
.array intersect assoc
.array intersect key
.array intersect uassoc
.array intersect ukey
.array intersect
.array key exists
.array keys
.array map
.array merge recursive
.array merge
.array multisort
.array pad
.array pop
.array product
.array push
.array rand
.array reduce
.array reverse
.array search
.array shift
.array slice
.array splice
.array sum
.array udiff assoc
.array udiff uassoc
.array udiff
.array uintersect assoc
.array uintersect uassoc
.array uintersect
.array unique
.array unshift
.array values
.array walk recursive
.array walk
.array
.arsort
.asort
.compact
.count
.current
.each
.end
.extract
.in array
.key
.krsort
.ksort
.list
.natcasesort
.natsort
.next
.pos
.current()
.prev
.range
.reset
.rsort
.shuffle
.sizeof
.count()
.sort
.uasort
.uksort
.usort
 
   

  key  


key

(PHP 3, PHP 4, PHP 5)

key -- Retourne une clé d'un tableau associatif

Description

mixed key ( array &array )

key() retourne la clé courante dans le tableau array.

Exemple 1. Exemple avec key()

<?php
$array
= array(
    
'fruit1' => 'pomme',
    
'fruit2' => 'orange',
    
'fruit3' => 'raisin',
    
'fruit4' => 'pomme',
    
'fruit5' => 'pomme');

// Cette boucle affiche toutes les clés
// dont la valeur vaut 'pomme'

while ($fruit_name = current($array)) {
    if (
$fruit_name == 'pomme') {
        echo
key($array) . '<br />';
    }
    
next($array);
}
?>

Voir aussi current() et next().


    Annonces       
 

 Retour au chapitre Php

 

Top
 

Ajouter JungleKey.fr à votre Explorateur

 
 

About Us | © 2007 JungleKey




iBlack | Mobile | Wiki | Ajouter ce moteur