unexpected T_IF, if statement in array

fteamdns

New Member
I can't figure out why I get Parse error: syntax error, unexpected T_IF on line 6.\[code\] $sf = array ( "name" => $firstname . ' ' . $lastname, "email" => $email, "address" => $shipping_address_1 . if(!empty($shipping_address_2 )) { echo ", " . $shipping_address_2 } ); print_r($sf);\[/code\]I want to check if $shipping_address_2 is not empty, and if it's not, then display it.
 
Back
Top