سؤال

Can anyone tell me what is wrong with the below shorthand if/else code?

<div class="holder <?php echo (!empty($bid_info['sale_price'] ? 'holder7' : 'holder4'); ?>">

According to this page it seems right!?

Though I am getting the below error:

Parse error: syntax error, unexpected '?', expecting ')' in ...........
هل كانت مفيدة؟

المحلول

Missing ) before the ?

 <?php echo (!empty($bid_info['sale_price']) ? 'holder7' : 'holder4'); ?>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top