Simplifier un if ?
analog101
Messages postés
173
Date d'inscription
Statut
Membre
Dernière intervention
-
avion-f16 Messages postés 19268 Date d'inscription Statut Contributeur Dernière intervention -
avion-f16 Messages postés 19268 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Et-il possible de simplifier le if ?
if (($id == 1866) || ($id == 3085) || ($id == 2945) || ($id == 1385))
{
..
}
Merci!
Et-il possible de simplifier le if ?
if (($id == 1866) || ($id == 3085) || ($id == 2945) || ($id == 1385))
{
..
}
Merci!
A voir également:
- Simplifier un if ?
- If exist - Forum Programmation
- The realtek network controller was not found. if deep sleep mode is enabled please plug the cable - Forum Pilotes (drivers)
- Php if multiple conditions ✓ - Forum PHP
- Carte ethernet deep sleep mode ✓ - Forum Pilotes (drivers)
- If else batch - Forum Autoit / batch
2 réponses
Salut,
https://www.php.net/manual/fr/function.in-array.php
<?php
$allowed = array(1866, 3085, 2945, 1385);
if(in_array($id, $allowed)) {
}
https://www.php.net/manual/fr/function.in-array.php