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

Home » Imported messages » comp.lang.php » use of array_key_exists() to prevent duplicates?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: use of array_key_exists() to prevent duplicates? [message #173015 is a reply to message #173014] Thu, 17 March 2011 17:09 Go to previous messageGo to previous message
William Gill is currently offline  William Gill
Messages: 31
Registered: March 2011
Karma:
Member
On 3/17/2011 11:58 AM, Captain Paralytic wrote:
>
> Alternative 1) Just assign the values to an associative array with the
> serial number as the key. At the end a foreach will produce a list of
> unique values. No need for array_key_exists() at all.
>
Is this any more efficient than if (array_key_exists()) ?
On the minus side, if I edit or modify the memo, it will be overwritten
using this alternative. I could avoid this, but it seems unnecessarily
complicated.

> Alternative 2) If you are planning on storing the data in a database
> just use INSERT IGNORE.

Had considered this, but at present a flat file seems adequate.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Php Modal
Next Topic: Pipe the content of a variable to a process
Goto Forum:
  

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

Current Time: Thu Nov 28 12:11:16 GMT 2024

Total time taken to generate the page: 0.04550 seconds