Simpler way to check if variable is not equal to multiple string values?

前端 未结 7 1277
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 19:11

Current Codes:



        
7条回答
  •  星月不相逢
    2020-12-04 19:40

    If you're planning on building a function in the if statement, I'd also advise the use of in_array. It's a lot cleaner.

    If you're attempting to assign values to variables you can use the if/else shorthand:

    $variable_to_fill = $some_variable !== 'uk' ? false : true;
    

提交回复
热议问题