how to use php within an echo with html

0

Within a php file I generate a html content for an echo, my question is how do I use a for php within that echo.

example of how I'm trying to do;

    echo '<div name="estrelas-cliente">
    'for($i =1; $i <= 2 ; i++){'
      <p>teste</p>
    '}'
    </div>'
    
asked by anonymous 29.11.2018 / 04:47

1 answer

1

You do the normal echo of div and echo within the for:

echo '<div name="estrelas-cliente">';
for($i =1; $i <= 2 ; i++){
  echo '<p>teste</p>';
}
echo '</div>';
    
29.11.2018 / 05:05