Answer the question
In order to leave comments, you need to log in
Why $inputs = 0?
$inputs = '';
$inputs .= '<input type="hidden" name="item_name_' . $index ? $index : 1 . '>" value="' . $item['title'] . '">
<input type="hidden" name="quantity_' . $index ? $index : 1 . '" value="' . $count . '">
<input type="hidden" name="amount_' . $index ? $index : 1 . '" value="' . $total . '">';
Answer the question
In order to leave comments, you need to log in
The concatenation is performed before the ternary operator. As a result, your line looks like
$inputs .= ('<input type="hidden" name="item_name_' . $index)
? $index
: (1 . '>" value="' . $item['title'] . '"><input type="hidden" name="quantity_' . $index)
? $index
: (1 . '" value="' . $count . '"><input type="hidden" name="amount_' . $index)
? $index
: (1 . '" value="' . $total . '">');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question