php - How can I make my switch statement case insensitive? -
in following example, $var
can "value", "value" or "value".
switch ( $var ) { case "value": // value , value don't seem match here. break; }
the comparison seems case sensitive (only all-lowercase "value" matches). there way perform case-insensitive comparison?
$var = strtolower($var)
and in switch cases write lowercase
Comments
Post a Comment