I have recently had to recode an echo statement on to two lines to get it to execute correctly. I was wondering if any one knew why. Original code:
<?php
echo $quantityDiscount['show_qty'] . '<br />' . (is_numeric($quantityDiscount['discounted_price'])) ? $currencies->display_price($quantityDiscount['discounted_price'], zen_get_tax_rate($products_tax_class_id)) : $quantityDiscount['discounted_price']; ?>
New code:
<?php
echo $quantityDiscount['show_qty'] . '<br />';
echo (is_numeric($quantityDiscount['discounted_price'])) ? $currencies->display_price($quantityDiscount['discounted_price'], zen_get_tax_rate($products_tax_class_id)) : $quantityDiscount['discounted_price']; ?>
The original code output "£22.50"
The new code output correctly "3-5<br />£22.50"
Am I missing something or is this a feature of php 7.
' . is_numeric(...)` is the condition. PHP doesn't know whether you mean `($q . '' . is()) ? :` or `$q . '' . (is() ? :)`. – deceze Jan 19 '18 at 16:32