PHP alternative syntax confusion Newbie to PHP.

Trying to output the results of an array inside a foreach loop. I have got the following code but I cannot understand what to do with it next. 

Mainly;


Where/how do I start and end the php statements?
Is there a better way to format this code? 


I want to make it as easy to understand and legible as possible.

I'm not sure how to echo my rows within the specified html below?

My code so far;

&lt;?php foreach ($userResults as $row) : ?&gt;
&lt;div class="row"&gt;
        &lt;ul class="list-group"&gt;
            &lt;li class="list-group-item"&gt;echo $row['user_id'] here&lt;/li&gt;
            &lt;li class="list-group-item"&gt;echo $row['user_name'] here&lt;/li&gt;
            &lt;li class="list-group-item"&gt;echo $row['user_email'] here&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
&lt;?php endforeach; ?&gt;


Any help or advice is appreciated.
I dont think mixing html inside PHP the way Tim Penner does in his first example is very readable or maintainable, i'd prefer the way you're trying to do it.

If you're using PHP 5.4+ and do not need the code to be working in earlier php versions i'd recommend you use the short_open_tag &lt;?= to echo out variables easily.

&lt;?php foreach ($userResults as $row) : ?&gt;
&lt;div class="row"&gt;
        &lt;ul class="list-group"&gt;
            &lt;li class="list-group-item"&gt;&lt;?= $row['user_id']; ?&gt;here&lt;/li&gt;
            &lt;li class="list-group-item"&gt;&lt;?= $row['user_name']; ?&gt;here&lt;/li&gt;
            &lt;li class="list-group-item"&gt;&lt;?= $row['user_email']; ?&gt;here&lt;/li&gt;
        &lt;/ul&gt;
&lt;/div&gt;
&lt;?php endforeach; ?&gt;


This is in my mind more readable and maintainable.