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

Home » Imported messages » comp.lang.php » in_array performance in unsorted vs sorted array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
in_array performance in unsorted vs sorted array [message #178204] Wed, 23 May 2012 06:20 Go to previous message
William Gill is currently offline  William Gill
Messages: 31
Registered: March 2011
Karma:
Member
I am reading transaction records from files. Each record has an
alphanumeric GUID but that record may be repeated in more than one file
(because of overlapping samples). I don't want to process duplicate
records, so I am considering a simple flat file to store the GUID's of
previously processed records.

To keep things simple I plan to use $done=file() to read the flat file,
and a simple if in_array to see if the current GUID has already been
processed, if not process the current record and add its GUID to $done.

Does anyone know if sorting an array has any significant impact on
in_array, or can I simply push push values into $done?

Also is there a better way than foreach() write() to get $done back into
the flat file?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Windows binaries 64bit for PHP
Next Topic: On the usage of "@" (error control operator)
Goto Forum:
  

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

Current Time: Fri Nov 22 05:29:17 GMT 2024

Total time taken to generate the page: 0.04104 seconds