web-profile

php while endwhile

Syntax with "endwhile" used mostly in complex templates where easier to find "endwhile" than "}":

<?php
$i = 1;
while ($i <= 10):
	echo $i++;
endwhile; 
?>

Classic syntax:

<?php
$i = 1;
while ($i <= 10) {
	echo $i++;
}
?>

Leave a Reply

Your email address will not be published.