我只是想不出代码。我有太多要更改为 switch 语句的 if 语句,但我找不到逻辑。
目前我有:
if(strstr($var,'texttosearch'))
echo 'string contains texttosearch';
if(strstr($var,'texttosearch1'))
echo 'string contains texttosearch1';
if(strstr($var,'texttosearch2'))
echo 'string contains texttosearc2h';
//etc etc...
但是我怎样才能在交换机中实现同样的效果呢?