title: PHP nest variable in echoed string that contains a HTML tag in the end
body: <p>need php help</p>
  
  <p>I need to add the if statement inside the html tag</p>
  
  <pre><code>if( get_field($image) ):
      ?&gt;&lt;img src="&lt;?php the_field($image); ?&gt;" alt="" /&gt;&lt;?php
  endif;
  </code></pre>
  
  <p>I want to add the if statement inside the html tag below in place of img and a, is that possible?</p>
  
  <pre><code> echo 
  
      "&lt;$html class=\"" .(!empty($this-&gt;options['class']) ? trim($thesis-&gt;api-&gt;esc($this-&gt;options['class'])) : ''). "\"&gt;  
  
   // I want this if statement to work inside here...how do i escape the html to make it work?
  
  if( get_field($image) ):
          ?&gt;&lt;img src="&lt;?php the_field($image); ?&gt;" alt="" /&gt;&lt;?php
      endif;
  
  
      &lt;img src=\"" .get_field($image)."\" alt=\"\" /&gt; 
       &lt;a href=\"".get_field($download). "\"&gt; Download File&lt;/a&gt; 
  
      &lt;/$html&gt;\n";
  </code></pre>