Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11844
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: searching an array |
| Date | 2013-11-18 18:23 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <l6dlv7$5ba$3@dont-email.me> (permalink) |
| References | <1r19n2u8ujc0e$.kh04fdyfhu79$.dlg@40tude.net> |
On Sun, 17 Nov 2013 22:37:44 -0500, richard wrote:
> $flip2=array_search($flip,$six0);
>
> if ($flip2=null){echo "does not exist";}
>
> How do I properly code it so that when a match is not found?
> Neither null or "" seems to work.
TL;DR: RTFM!
You read the php manual for the search function which you're using and
take very careful note of the value returned when the needle item is not
found in the haystack item. Then you test for that value.
Instead of testing for some random value that enters your head.
--
Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
searching an array richard <noreply@example.com> - 2013-11-17 22:37 -0500
Re: searching an array Richard Yates <richard@yatesguitar.com> - 2013-11-17 20:57 -0800
Re: searching an array richard <noreply@example.com> - 2013-11-18 00:28 -0500
Re: searching an array David Robley <me@home.invalid> - 2013-11-18 21:57 +1030
Re: searching an array Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-18 11:38 -0500
Re: searching an array Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-18 18:24 +0000
Re: searching an array Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-18 18:23 +0000
csiph-web