检查变量是否不等于多个字符串值的更简单方法?
2022-08-30 09:32:56
						当前代码:
<?php
  // See the AND operator; How do I simplify/shorten this line?
  if( $some_variable !== 'uk' && $some_variable !== 'in' ) {
    // Do something
  }
?>
和:
<?php
  // See the OR operator; How do I simplify/shorten this line?
  if( $some_variable !== 'uk' || $some_variable !== 'in' ) {
    // Do something else
  }
?>
有没有更简单(即更短)的方法来编写这两个条件?
注意:是的,它们是不同的,我期待以不同的方式缩短代码。
 
					 
				 
				    		 
				    		 
				    		 
				    		