I am wresting with printing shipping labels and getting the final output to omit a second address line if one exists. Is there a way to conditionally exclude the line break if $address2 is empty when using sprintf()?
while($rows=mysql_fetch_array($result)){
$name = $rows['address_name'];
$address = $rows['street1'];
$address2 = $rows['street2'];
$citystatezip = $rows['city'].', '.$rows['state'].' '.$rows['zip'];
$country = $rows['country'];
$text = sprintf("%s
%s
%s
%s
", $name, $address, $address2, $citystatezip, $country);
$pdf->Add_Label($text);
}