我只是问自己,有两种方法可以实现这一点。什么更适合编码标准?还是这只是个人的事情?
And what about php and memory, assuming this would be way more complicated and executed very often. Would it cost more memory to create a function or a variable?
解决方案1:
function stuff(){
[...]
$fluid = ( current_theme_supports(\'greatness\') ) ? \'-greatness\' : \'\';
$output = \'<div class="box\' . $fluid . \'">\';
[...]
}
解决方案2:function stuff_alternative(){
[...]
$output = \'<div class="box\' . bootgen_is_great() . \'">\';
[...]
}
function bootgen_is_great(){
if ( current_theme_supports( \'greatness\' ) )
return \'-greatness\';
}