?php $a = array( 1 = 'one', 2 = 'two', 3 = 'three'); unset($a[2]); / * will produce an array that would have been defined as $a = array(1 = 'one', 3 = 'three'); and NOT $a = array(1 = 'one', 2 = 'three'); * / $b = array_values($a); / / Now b is array(1 = 'one', 2 = 'three')?
?php / / Array comme correspondance $map = array( 'version '= 4, 'OS' = 'Linux ', 'langue' = 'français ', 'short_tags' = TRUE); / / valeur strictement numériques $array = array (7, 8, 0, 156, -10); / / ceci est la même chose que array (0 = 7, 1 = 8,...) $switching = array (10 / / clé = 0, 5 = 6, 3 = 7, 'a '= 4, 11 / / clé = 6 (index maximum: