Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15781
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Looking for NULL in arrays |
| Date | 2015-10-25 19:06 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <1854724.EiBtr6myrt@PointedEars.de> (permalink) |
| References | <d94ctvFn9f4U1@mid.individual.net> |
Derek Turner wrote: > The problem is not that I don't know how to iterate through an array - > the problem is that there are so many ways and I can't see the wood for > the trees -which is the easiest method? foreach > I have a simple array called $weeks. At the moment it contains either > three string values or 5 could easily make it a consistent five if > necessary. Your sentences are incoherent. You cannot just be posting as you are just thinking; you have to make an effort to put your thoughts in proper words. In doing that, you will learn to think clearly, maybe even arrive at the solution yourself. > $weeks[1] always contains a string. [2], [3] etc. either contain a string > or NULL from mysql query. > > I want to iterate through in key order until either [5] or a NULL value > is found. What would do that, please? “foreach” over an array that contains the array keys in order. RTFM. > Is there a simple way without having to use an 'if' or similar test? No. > I'm thinking something similar to > > while ($row = $result->fetch_asoc()); > > that will detect a NULL value and stop. This will detect a false-value, *including* NULL, and then stop. > IYSWIM. Pardon? -- PointedEars Zend Certified PHP Engineer 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
Looking for NULL in arrays Derek Turner <frderek@suremail.je> - 2015-10-25 16:05 +0000
Re: Looking for NULL in arrays Derek Turner <frderek@suremail.je> - 2015-10-25 16:11 +0000
Re: Looking for NULL in arrays Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-25 19:07 +0100
Re: Looking for NULL in arrays Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-25 19:06 +0100
Re: Looking for NULL in arrays Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-10-25 21:01 +0100
Re: Looking for NULL in arrays Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-25 21:58 +0100
Re: Looking for NULL in arrays Jerry Stuckle <jstucklex@attglobal.net> - 2015-10-25 16:33 -0400
Re: Looking for NULL in arrays Derek Turner <frderek@suremail.je> - 2015-10-26 09:42 +0000
Re: Looking for NULL in arrays Jerry Stuckle <jstucklex@attglobal.net> - 2015-10-26 09:45 -0400
Re: Looking for NULL in arrays Derek Turner <frderek@suremail.je> - 2015-10-26 13:57 +0000
Re: Looking for NULL in arrays Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-10-26 17:41 +0100
Re: Looking for NULL in arrays Jerry Stuckle <jstucklex@attglobal.net> - 2015-10-26 12:49 -0400
Re: Looking for NULL in arrays Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-26 22:25 +0100
Re: Looking for NULL in arrays Denis McMahon <denismfmcmahon@gmail.com> - 2015-10-27 03:16 +0000
Re: Looking for NULL in arrays Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-27 22:23 +0100
csiph-web