how to use php inside an echo with html

Asked

Viewed 168 times

0

within a php fileThere is html content by an echo, my doubt 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>'

1 answer

1


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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.