FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » searching an array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: searching an array [message #183775 is a reply to message #183740] Mon, 18 November 2013 18:23 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
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(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: file size
Next Topic: array search part 2
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 09:58:56 GMT 2024

Total time taken to generate the page: 0.05202 seconds