Help with an if statement?

Hello all,

I have a string of text with an if statement in it. But I get a parse error stating there is an unexpected if statement. Can anyone help?


  $var .= '
  <a href="http://www.theurl.com" '.if($new !='') { echo 'target=\\"_blank\\"'; }.'>Click Here</a>';
     }

Thanks

easier to read
<?php
$target=‘’;
if ($new!=‘’)
{
$target='‘target=\“_blank\”’;
}

$var=“<a href=\“http://www.theurl.com\” $target>Click Here</a>”;
?>
how is that

I’ll chime in. :slight_smile:


printf(
    '<a href="http://www.example.com/" &#37;s>example.com</a>',
    ('' === $new) ? 'target="_blank"' ; ''
);