I can't figure out why I get Parse error: syntax error, unexpected T_IF on line 6.
$sf = array (
"name" => $firstname . ' ' . $lastname,
"email" => $email,
"address" => $shipping_address_1 . if(!empty($shipping_address_2 )) { echo ", " . $shipping_address_2 }
);
print_r($sf);
I want to check if $shipping_address_2 is not empty, and if it's not, then display it.
ifstatement is invalid there. Statements cannot be used inside expressions (apart from expression statements).