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?

ref: http://php.net/manual/en/control-structures.switch.php

$var = strtolower($var) 

and in switch cases write lowercase


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -