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

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -