mardi 27 janvier 2015

If either of 2 cookies exist do this... PHP

I know that || or && need to be used but I can't work out the correct or best way to format this.


My code for one cookie...



if(isset($_COOKIE['mycookie'])) {
if($_COOKIE['mycookie']=="value1") {
// do some stuff
}
}


But i'd like to include another cookie in this routine where either one can be true for the "stuff" to work.


I'm just not sure how to format this.


Is it something like...



if(isset($_COOKIE['mycookie'] || ['mycookie2')) {
if($_COOKIE['mycookie']=="value1" || $COOKIE['mycookie2']=="value2") {
// do some stuff
}
}

Aucun commentaire:

Enregistrer un commentaire