0
有没有更简单的方法来编写下面的代码?这将比2例大得多,所以很快就会很难处理。简化if-else语句
if ($result == 'yes')
{
echo 'this text';
}
else if ($result == 'no')
{
$result = in_string($kairos_array, explode(' ', $input_string));
if ($result == 'yes')
{
echo 'that text';
}
}
http://php.net/manual/ en/control-structures.switch.php? – AbraCadaver
使用'switch/case'语句。什么会超过两个?在else if($ result =='no')'块内?或者在外部if/elseif中增加额外的'else if'语句? –