Variable de nido PHP en una cadena con eco que contiene una etiqueta HTML al final [cerrado]

Necesito ayuda de PHP

Necesito agregar la sentencia if dentro de la etiqueta html

if( get_field($image) ):
    ?><img src="<?php the_field($image); ?>" alt="" /><?php
endif;

Quiero agregar la sentencia if dentro de la etiqueta html a continuación en lugar de img y a, ¿es posible?

 echo 

    "<$html class=\"" .(!empty($this->options['class']) ? trim($thesis->api->esc($this->options['class'])) : ''). "\">  

 // I want this if statement to work inside here...how do i escape the html to make it work?

if( get_field($image) ):
        ?><img src="<?php the_field($image); ?>" alt="" /><?php
    endif;


    <img src=\"" .get_field($image)."\" alt=\"\" /> 
     <a href=\"".get_field($download). "\"> Download File</a> 

    </$html>\n";

Respuestas a la pregunta(1)

Su respuesta a la pregunta