4
My array $tx
is:
Array
(
[tax_val] => Air bag
)
testing:
echo (in_array('Air bag',$tx['tax_val'])?'Existe':'Não existe');
Returns:
Warning: in_array() expects Parameter 2 to be array, string Given in .....
I tested if it is array, cut ARRAY:
if(is_array($tx)) {
echo '<p>ARRAY</p>';
} else {
echo "<p>NAO ARRAY</p>";
}
Changing the code to:
echo (is_array($tx) && in_array('Air bag',$tx['tax_val'])?'Existe':'Não existe');
Returns nothing.
I need it to be ternary, but it doesn’t work, which is wrong if it has two values in the in_array()
?
Thanks for the help, it was of great value!
– ElvisP