41 PHP optimization tips
27/11/2008 | external link
As with any tips for optimization, it’s best advised to benchmark your code first rather than just start hacking and slashing your code. With that said and understood, I enjoy reading articles for better optimizing PHP code and came across this one from reinholdweber with 40 tips + 1 bonus tip that looks pretty good. [...]
Talk like a pirate text filter suite by Dougal Campbell
27/11/2008 | external link
Today is Talk Like A Pirate Day. Appropriate day to implement Dougal Campbell’s text filter suite Wordpress plugin which includes the Talk Like a Pirate filter. Every post and every comment today only on September 19 will have the text converted to pirate speak.
It works with the most recent version of Wordpress, 2.2.3. To install [...]
Formatting numbers with sprintf
27/11/2008 | external link
In the game Keno you might have noticed that games begin at 001 and iterate to 999. Let’s look at some code to cycle properly and stay formatted in three digits using sprintf().
$game_number = 1;
echo ‘Game #’ . sprintf(“%03d”,$game_number); // Game #00x
Now let’s add some style magic to give the output a blackground with [...]
Date and time page last updated
27/11/2008 | external link
A PHP one-liner to keep the date/time the page was last updated:
page last updated <?php echo date(“F d Y H:i:s”, getlastmod() ); ?>
Note: uses the server timezone by default. getlastmod() returns a timestamp and if you are on a shared server (virtual hosting) and cannot change the timezone, let’s say the timezone is off by [...]
PHP still #4 programming language, Ruby on the move in TIOBE index
27/11/2008 | external link
The TIOBE Programming Community index tracks the popularity of different programming languages. Over the last year positions #1-6 have not changed with PHP holding at #4 behind Java (#1), C (#2) and C++ (#3).
Heard a lot about Ruby over the last year or so? It moved from #21 to #11. Definitely on the move.
How to use MySQL REPLACE function
27/11/2008 | external link
Here’s a MySQL query fuction that’s easy to forget about: REPLACE. Let’s say I have a bunch of records in a field with http://www and want to quickly change all to http://. Here’s the syntax to update:
UPDATE tdurl_1 SET URL = REPLACE(URL, ‘http://www.tdurl.com/’,'http://tdurl.com/’);
Yahoo has PHP programming positions available
27/11/2008 | external link
Rasmus Lerdorf, creator of PHP, posts about PHP programming positions available at Yahoo:
Send me your resume and let me know what sort of stuff you are interested in or poke around on http://careers.yahoo.com/ and let me know which job interests you and I will forward your resume to the appropriate hiring manager.
Perl to PHP cheatsheet
27/11/2008 | external link
Sooner or later you may want or need to port some Perl code to PHP. This Perl to PHP translation cheatsheet may come in handy.
How to build a how many days in the future script with timezone offset
27/11/2008 | external link
This morning I was wondering what the date would be an arbitrary number of days in the future, like if somebody says: get back to me in a few months. I decided to search Google to see if there was a simple, web-based form that I could enter in the number of days in the [...]
How to randomize, return and remove numbers from a pool
27/11/2008 | external link
This morning in the IRC chat (irc.scriptschool.com #scriptschool) a random visitor named Rnd-Amarion stopped by with the following how-to PHP question:
I am about to learn PHP, and want to program a simple web page with a long string of random numbers. I have the random numbers allready. When someone queries the web site, it retrieves [...]




