Quantcast
Channel: a day in the pit » PHP
Browsing latest articles
Browse All 3 View Live

Just a quick time comparison of PHP’s preg_replace vs. str_replace

Here's a short and succinct comparison of running time to replace multiple characters in a given string. I ran the test 20 times each, so the numbers you will find are average running times: $start =...

View Article



PHP array_diff vs foreach: a battle for speed

1000 runs w/ 1000 data elements in the two arrays (php array diff): 2.7389E-5 seconds 1000 runs w/ 1000 data elements in the two arrays (php foreach): 1.085E-7 seconds php array diff slower by 2.728E-5...

View Article

PHP 5.2 mysql_connect w/ same parameters does not return a new connection!

This is subtle... I was writing some "reconnect" logic for a DB Class to catch and handle MySQL error code 2006, Server Gone Away. After a solid 5 hours of wasted time I traced the poor logic on my...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images