note 116144 deleted from control-structures.foreach by salathe
| From: | salathe@php.net | Date: | Mon, 17 Nov 2014 15:56:56 +0000 |
| Subject: | note 116144 deleted from control-structures.foreach by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200935@lists.php.net to get a copy of this message | ||
Note Submitter: gdanen at gmail dot com
----
A suggestion was made to use the alternate form
<?php
foreach($array as $element):
#do something
endforeach;
?>
In my mind this is counter-intuitive, and I have seen it only once.
I would suggest using the standard form with curly braces:
<?php
foreach($array as $element) {
// do something
}
?>