W3Schools

29th March 2008

W3Schools is one of the best online tutorial sites available, but in addition to that, the site is completely free. When I can't remember how a particular bit of syntax goes I can be pretty much certain that I will find it on this site. There are thousands of examples, explanations, quizzes and reference charts available and they don't bog you down in too much detail. The examples on the site tell you exactly what you need to know about the subject so that you can copy the code and get on with the task at hand.

Creating A URI Slug With PHP

28th March 2008

The use of mod_rewrite on a site can have a powerful effect on search engine positioning, but to do it properly you will need to create a "slug" for each page. A slug is a lowercase alphanumeric version of the page title, with any spaces removed.

To get a slug you will need to use a function to turn a readable page title into a string that can be used as part of a URI.

PHP Browser Detection

27th March 2008

Retrieving the current user agent using PHP is done via the use of the $_SESSION super global array. The following line of code will print off your user agent.

echo $_SERVER['HTTP_USER_AGENT'];

For Firefox on Windows this user agent will look like this.

PHP Easter Eggs

26th March 2008

There are a couple of hidden features that you can see on just about any PHP driven website. You can get either an image or a list of credits for PHP by appending one of the following strings to the end of the URL.

The glob() Function In PHP

25th March 2008

The glob() function in PHP uses simple pattern matching to find files and directories in a directory and return those file names as an array. It simplifies all of the PHP directory functions, so instead of opening the directory and then reading every file name one by one, you can just use glob() and so it in one function call. Additionally, glob() works very closely with the file system and so it very quick.

Here is a simple example.

Common Regular Expressions

Here are some of the regular expressions that I frequently use.

Find a blank line

^$

Spaces

[ \t]+

You can use this to break a text string apart into words.

Date

\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}

This will match anything in the format mm/dd/yyyy, or even dd/mm/yyyy.

philipnorton42 Mon, 03/24/2008 - 09:32

MooTools Home Page

23rd March 2008

If you are looking for information about the MooTools JavaScript framework then your first stop should be the MooTools home page. The site not only allows you to download MooTools, but it is also a great resource for learning how to use MooTools.

RegExLib.com: The Regular Expression Library

22nd March 2008

Writing regular expressions can sometimes be a real pain, especially if you are not used to them. Rather than trying for yourself to make a regular expression you might want to think about looking for regular expressions that other people have made. Rather than reinventing the wheel to prove you can do something,using free third party regular expressions can save you a lot of time.

reWork: A Regular Expression Workbench

21st March 2008

Regular expressions are a very useful tool for any programmer wanting to validate input, format strings, change words, reformat data or even split apart a string into an array. However, when you are starting out, writing them it can be hard going, they are not very easy to learn and the only way to really understand them is to practice, practice, practice.

Finding The Latest Timestamp Value From A Set Of Values In MySQL

20th March 2008

Storing sets of data with a timestamp is common practice, especially if you want to keep a history of the values that have been stored previously. Lets say you wanted to store a piece of information about two variables, each of which can have a history. Here is an example dataset.