What is this Colon inside foreach statement for php?

Viewed 4194

Okay I am officially confused. I'm reading up on this MVC intro in php and I see this code, and I added some items into array on top to see if it really works.

  <?php 
 $members  = array('apple', 'oranges', 'banana');
  ?>

<html>
<h1>Members of community.com:</h1>
<ul>
<?php foreach ($members as $i => $member) : ?>
<li>Member #<?php echo $i + 1; ?>: <?php echo $member; ?></li>
 <?php endforeach; ?>
 </ul>
</html>

I notice there's a : in the line of the foreach statement. Where does this come from? More importantly, what is it? Is this : symbol mean "okay we will continue this statement in the next line" ?

But besides that, this is cool trick I learned. Less html tags inside my php echo's I guess.

let me know what you think, thanks!

2 Answers
Related