Simplifier un if ?
analog101
Messages postés
173
Date d'inscription
Statut
Membre
Dernière intervention
-
avion-f16 Messages postés 19252 Date d'inscription Statut Contributeur Dernière intervention -
avion-f16 Messages postés 19252 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 ?
- Simplifier une image ✓ - Forum Photoshop
- If exist - Forum Java
- The realtek network controller was not found. if deep sleep mode is enabled please plug the cable ✓ - Forum Pilotes (drivers)
- If char ✓ - Forum Programmation
- The Realtek Network Controller was not found. - Forum Pilotes (drivers)
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