phpsqlet:booleans
This is an old revision of the document!
Array Functions
Beaucoup de fonctions.
$a = array(3,2,4);
// count, min, max
echo count($a); // 3 : longueur
echo min($a); // 2 : valeur minimum
echo max($a); // 4 : valeur maximum
/sort, rsort
// fonction destructive : agit sur le tableau
sort($a); // 2,3,4 : tri croissant
rsort($a); // 4,3,2 : tri décroissant
// implode, explode
$string = implode(" * ", $a); // "4 * 3 * 2"
$b = explode(" * ",$string); // 4,3,2 : crée un array
// recherche
echo in_array(0, $a); // rien (false)
echo in_array(2, $a); // 1 (true)
→ php.net/manual/en/ref.array.php
- array_keys
- array_values
- array_push
- array_pop
- array_shift
- array_unshift
- array_unique
- array_search
- array_random
- etc.
phpsqlet/booleans.1460558946.txt.gz · Last modified: 2016/04/13 16:49 by leo