Archives For Tips

php $_server... because of ports, duh

photo by Piet Musterd

The PHP $_SERVER superglobal allows you access to some truly useful information about the client browser, the web server environment, and the current page context. We all know the basics of what this array holds, but here I go into a bit more detail to find out what else it can tell us…


Wordpress PerformanceWordPress has a low barrier to entry and encourages experimentation, which are both good things for developers. But once a WordPress site is up and running, you need to get it running fast enough to keep Google happy. Luckily WordPress performance is easy to get started with: there are quite a few quick things you can do to improve the performance of vanilla WordPress installs.

Check out the video for an overview of the wordpress cron system. Here’s some background information:

Sometimes on a wordpress site you need to run a job at regular intervals. Say, for example, you store draft customer details when people are browsing your site; and you want to remove them if they haven’t completed their registration after a couple of days. Now, there is a good system in Unix OSes called cron that will do this, but it’s not always suitable… (more…)

I’ve been doing some work with random strings lately and, in an effort to improve the speed of my code, did some testing. I discovered an interesting alternative to php rand… (more…)

The problem: measuring PHP performance

It’s not always easy to tell why your PHP is not running well. Sometimes you need to spend some time hunting through your code examining how well it is performing at various places, eliminating bottlenecks as you go. You probably also want debugging info to be visible and easy to read. Here’s how I’ve been doing it lately, using a new php class called GLPTimer… (more…)

url filtering: #83 filtered flareURL filtering is important: everyone from marketers to search engines loves nice, text-rich URLs. If you want to create keyword-rich URLs based on your dynamic content then you need to clean and filter the source text first. Here is a handy function that will generate text very much like WordPress slugs… You can use this pretty much anywhere. I’ve used it mostly in tagging systems, and in code that creates permalinks based on post titles or taxonomy terms. (more…)