News Feed
Sections

News Archive


Community Events






Don't see your event here?
Let us know!


feed this:

Brian Moon's Blog:
in_array is quite slow
1 comment :: posted Friday June 06, 2008 @ 09:36:47
voice your opinion now!

Brian Moon had a problem - one of his cron jobs was lasting for much longer (hours!) than it should have been. He tweaked, tested and debugged the script and finally came down to a call to in_array, something he comments on as being "quite slow".

See, this job is importing data from a huge XML file into MySQL. After it is done, we want to compare the data we just added/updated to the data in the table so we can deactivate any data we did not update. [...] We then compared the two arrays by looping one array and using in_array() to check if the value was in the second array. [...] So, that was running for hours with about 400k items. Our data did not contain the value as the key, but it could as the value was unique.

He method, replacing the in_array call that had to do a full array scan for each time through the loop with an isset/unset combo on the unique key, changed the execution time down from about 4 hours to 0.8 seconds.

tagged with: inarray compare array unset isset unique key execution time


Phil Thompson's Blog:
7 PHP functions that saved my life
0 comments :: posted Tuesday January 22, 2008 @ 11:08:00
voice your opinion now!

On his blog, Phil Thompson lists seven PHP functions that "saved his life" when developing his apps:

From time to time, I've struggled with minor pieces of coding for what seems like an age and then I've discovered PHP has a ready-made function whose express purpose seems to be to fix my exact problem. Today, I name and honour those PHP functions which saved my life, my career and my sanity.

Functions that made the cut include:

He has his own reasons for each - all of them being handy little functions that fill a specific niche in PHP's vast array of abilities.

tagged with: handy function numberformat arrayvalues isset arraydiff


zend releases book PHP5 zendframework package application job developer conference database code release security mysql PEAR cakephp ajax framework example

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework