Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16614
| Path | csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.php |
| Subject | Re: break foreach loop after certain iteration and then start it |
| Date | Sat, 05 Mar 2016 11:46:25 +0100 |
| Organization | PointedEars Software (PES) |
| Lines | 46 |
| Message-ID | <1522528.enTpbkXFfR@PointedEars.de> (permalink) |
| References | <6586983f-c3bc-4eb7-92a3-6035952e8cbb@googlegroups.com> <56D946D4.9030504@arnowelzel.de> <2056947.pXOX0CipXs@PointedEars.de> <56DAAC64.6010102@arnowelzel.de> |
| Reply-To | Thomas 'PointedEars' Lahn <usenet@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | solani.org 1457174785 4422 eJwNxscRwDAMA7CVVEiVceyctP8IDl6gh8aXCAa4XNcTMDtblPECPEvGpHF1OQaf9Lw90pT/D/wVD+M= (5 Mar 2016 10:46:25 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Sat, 5 Mar 2016 10:46:25 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| X-User-ID | eJwFwYEBwDAIArCbOkTrOY7h/ycsIfKkKpIZXO5zULzIKKW0nn1l9Czne4Gmuhi6fVakvY6psFZuE/gBac0Wow== |
| Cancel-Lock | sha1:3tYK6GPUaUWrx6Cp4DzpYKk4yCM= |
| X-NNTP-Posting-Host | eJwFwQcBADAIAzBL3DI7XP8SlriC0WFwmJ+fzKjRkGRIlSbHdVeQOq8HAwcgLzfmvVv5He0RWQ== |
| Xref | csiph.com comp.lang.php:16614 |
Show key headers only | View raw
Arno Welzel wrote:
> Thomas 'PointedEars' Lahn schrieb am 2016-03-05 um 02:28:
>> Arno Welzel wrote:
>>> <?php
>>> $counter = 0;
>>>
>>> foreach($mylist as $element)
>> ^^
>>> {
>>> […]
>>> if($counter==3)
>> ^^
>> Flow control statements should not be written like function calls.
>
> Which is a matter of style.
Yes, therefore *I* said “should”.
> I recognize flow control statements also when they are not formatted with
> a space preceding the first bracket ;-).
>
> But for beginners it may be helpful to distinguish between function
> calls and flow control.
*PHP Standards Recommendations (PSR)-2* says it is a “MUST” and a “MUST NOT”
respectively, instead: <http://www.php-fig.org/psr/psr-2/#1-overview>
> [...]
>> Or, if this is too confusing,
>>
>> if (($index + 1) % 3 === 0)
>
> […]
> When someone had enough knowledge to understand all this he would not
> ask here how to do something every third iteration within a foreach()
> loop.
This is still not a PHP support forum, but a newsgroup for discussion about
PHP.
--
PointedEars
Zend Certified PHP Engineer
<http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
break foreach loop after certain iteration and then start it apoorv.kanungo@gmail.com - 2016-03-03 22:08 -0800
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-04 09:27 +0100
Re: break foreach loop after certain iteration and then start it Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-05 02:28 +0100
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-04 21:32 -0500
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-05 10:52 +0100
Re: break foreach loop after certain iteration and then start it Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-05 11:46 +0100
Re: break foreach loop after certain iteration and then start it Tim Streater <timstreater@greenbee.net> - 2016-03-05 12:08 +0000
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-05 14:10 +0100
Re: break foreach loop after certain iteration and then start it Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-05 17:55 +0100
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-05 08:50 -0500
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-06 10:57 +0100
Re: break foreach loop after certain iteration and then start it Tim Streater <timstreater@greenbee.net> - 2016-03-06 11:26 +0000
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-06 10:12 -0500
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-06 22:48 +0100
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-06 20:49 -0500
Re: break foreach loop after certain iteration and then start it "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-03-07 16:28 +0100
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-07 12:38 -0500
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-07 17:42 +0100
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-07 12:39 -0500
Re: break foreach loop after certain iteration and then start it Arno Welzel <usenet@arnowelzel.de> - 2016-03-09 08:18 +0100
Re: break foreach loop after certain iteration and then start it "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-03-09 10:05 +0100
Re: break foreach loop after certain iteration and then start it Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-09 08:56 -0500
Re: break foreach loop after certain iteration and then start it "R.Wieser" <address@not.available> - 2016-03-04 09:34 +0100
csiph-web