Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| kb_it:php [2022/12/07 20:25] – befe | kb_it:php [2025/02/13 15:59] (Version actuelle) – befe | ||
|---|---|---|---|
| Ligne 22: | Ligne 22: | ||
| return array_keys($array) !== range(0, count($array) - 1); | return array_keys($array) !== range(0, count($array) - 1); | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | === Rechercher dans un tableau associatif === | ||
| + | |||
| + | <code php> | ||
| + | $people = array( | ||
| + | 2 => array( | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | 5=> array( | ||
| + | ' | ||
| + | ' | ||
| + | ) | ||
| + | ); | ||
| + | $found_key = array_search(' | ||
| + | </ | ||
| + | |||
| + | Attention, ça renvoie 1 et non 5 (c'est le 2ème élément du tableau). | ||
| + | |||
| + | Pour un gros tableau, il faut optimiser : | ||
| + | <code php> | ||
| + | $colors = array_column($people, | ||
| + | $found_key = array_search(' | ||
| </ | </ | ||
| Ligne 148: | Ligne 172: | ||
| ini_set(" | ini_set(" | ||
| var_dump($var); | var_dump($var); | ||
| + | </ | ||
| + | |||
| + | ==== Divers ==== | ||
| + | |||
| + | === Installer Composer rapidement === | ||
| + | |||
| + | <code bash> | ||
| + | curl -sS https:// | ||
| </ | </ | ||