If null use other variable in one line in PHP

前端 未结 12 785
说谎
说谎 2020-12-29 01:47

Is there in PHP something similar to JavaScript\'s:

alert(test || \'Hello\');

So, when test is undefined or null we\'ll see Hello, otherwis

12条回答
  •  渐次进展
    2020-12-29 02:21

    I recently had the very same problem.This is how i solved it:

    
                  

    Your value in the database is in variable $test..so if $test row is empty then echo Not Provided

提交回复
热议问题