Hoy en la tarde, Dave Thomas dijo:
I know there is a better way to do something like this in PHP:
if (($color == "red") || ($color == "blue") || ($color == "white") ||
($color == "yellow")) { .. }
Is there a way I can condense that so I don't have to write $color
everytime?
,----
| // can also be loaded from somewhere else, say, a db or file
| $available_colo rs = array('red', 'blue', 'white', 'yellow');
|
| if (in_array($colo r, $available_colo rs)) {
| ...
| }
`----
--
Cristian Gutierrez /*
cr******@dcc.uc hile.cl */
"Vampirewar e: /n/, a project, capable of sucking the lifeblood out of
anyone unfortunate enough to be assigned to it, which never actually
sees the light of day, but nonetheless refuses to die."