我有这样的代码:
$get_options = isset($options['big_heading']) ? ($options['big_heading']) : '' ;
但是我很难将其作为三元运算符来阅读,那么如何将其分解为 if 语句?对不起我的问题...谢谢!
我有这样的代码:
$get_options = isset($options['big_heading']) ? ($options['big_heading']) : '' ;
但是我很难将其作为三元运算符来阅读,那么如何将其分解为 if 语句?对不起我的问题...谢谢!
您的代码等于:
if(isset( $options['big_heading'])){
$get_options = $options['big_heading'];
} else {
$get_options = '';
}
它的语法总是这样的:$foo = (condition) ? if_its_true : if_its_not_true ;
这与
$get_options = isset( $options['big_heading']) ? ($options['big_heading']) : '' ;
这个
if(isset( $options['big_heading'])) {
$get_options = $options['big_heading'];
} else {
$get_options = '';
}
if(isset( $options['big_heading'])) {
$get_options = $options['big_heading'];
} else {
$get_options = '';
}
$get_options = "";
if(isset( $options['big_heading']))
{
$get_options = $options['big_heading']
}
$get_options = '' ;
if (isset( $options['big_heading'])) {
$get_options = $options['big_heading'];
}
干得好...
if (isset($options['big_heading'])){
$get_options = $options['big_heading'];
else{
$get_options = '';
}