If statement with condition isset and comparing not working together

后端 未结 1 905
栀梦
栀梦 2021-01-16 21:14

I\'m having a problems with making if statements:


    // code if detail variable exists and is equal t         


        
相关标签:
1条回答
  • 2021-01-16 21:59

    isset is a boolean operator which returns TRUE or FALSE. You don't need to compare it to 1.

    if( isset($detail) )
    

    As a side note, just because the variable is set, does not mean it's not empty. You may want to just check that it's not empty:

    if( !empty($detail) )
    
    0 讨论(0)
提交回复
热议问题