Building a PHPDoc parser in PHP
This is the second in a series of posts about how I built Doqumentor – The Runtime PHP Documentor. If you haven’t already, check out the first how I used the PHP Reflection API to document your code. So, the next step in the process of building Doqumentor was to build the PHPDoc parser to [...]
Using the PHP Reflection API to document your code
I have recently spent a bit of time writing a new PHP development tool for documenting code at runtime. Doqumentor – The Runtime PHP Documentor is a new way of documenting your PHP code – doing it at runtime rather that having to compile documentation using things such as PHPDocumentor. I am releasing the code [...]
Exploring the iPhone’s accelerometer through Javascript
The iPhone has had an accelerometer in it since the start, allowing users to tilt the device and it would pick up the orientation and movement and alter the screen as necessary. It is only recently however, that they have opened up access to the data to pages through the browser and the new devicemotion [...]
2010 Roundup
So, the end of the first year with the blog. I thought it would be quite good to end the year with a roundup of my top 5 posts. While the blog has only been going 6 months, I still have a good few to pick from so lets take a look. 5. How to [...]
Free UK Postcode Lookup with the Yahoo! PlaceFinder and Bing API
I recently posted about how to do free UK postcode lookup using the Google API, I think it is only fair to explore the Yahoo! and Bing alternatives to see where they differ. I think it is important to say now that due to the licensing restrictions, no free web service can offer full [...]
PHP Output and Concatenation Speed Comparison
There are a few commonly asked PHP questions: What is the difference between the print and echo constructs? What is the difference between single and double quotes? These questions are both answered very sufficiently by doing a quick search on Google. However, one thing often overlooked is the speed comparison between print, echo and single [...]
Free UK Postcode Lookup Using the Google Maps API
Google Maps has a well know API that can be used for great things. The most common one of course – putting a map on your website and placing markers to show where things are. One thing I never realised is that as well as the standard Javascript API that is most commonly used, Google [...]
Using PHP’s preg_replace with the ‘e’ modifier
For anyone that doesn’t know already, preg_replace is the PHP function for doing a regular expression replace on a string using a Perl Compatible Regular Expression (PCRE). It allows certain modifiers to be applied that modify the way the function works, one of the more interesting of these is the PREG_REPLACE_EVAL or ‘e’ modifier. For [...]
4 Little Known Useful PHP Functions
In this post I am going to go over 4 little known PHP functions that offer some great functionality that is sometimes re-written by people who don’t realise there is already a function. The functions I am going to look at are: highlight_string() levenshtein() str_word_count() wordwrap() highlight_string() This is a really useful function to output [...]
Render Fusion Charts on the server with .NET
If you are a regular reader of my blog, you will remember my “How to render Fusioncharts completely on the server” post which explained for to render Fusion Charts on the server using PHP. Since then, I have been in discussion with the great support team at Fusion Charts and they have written a .NET [...]
Turn an object into an array with the Standard PHP Library (SPL)
I have recently discovered the new SPL introduced with PHP 5 that allows a load of new functionality that can be added to classes in your code. In this post, I am going to look at how you can now create an class that has an interface that allows it to be used as if [...]
Replace PHP functions using namespaces
I have recently spent a while learning about the new features of PHP 5.3. One of the massive additions to the latest version is namespaces. Simply put, namespaces allow you to group related constants, classes and functions together under a namespace, allowing you to have the same function name in 2 different namespaces and not [...]
Prepared MySQL Statements in PHP
MySQL prepared statements are a feature added to PHP5 using the extended mysqli_* functions. They allow us a lot of improved functionality, mainly an easy way to run the same statement multiple times changing specific parameters, enhances security against SQL injection and performance increases. In this post, I will show you the traditional way of [...]
PHP Problem With Decimal (Floating) Calculations
One of my colleagues recently ran into a problem at work where, when doing a mathematical calculation with floating point numbers in PHP, he ran into some very unexpected results. Quite simply, here is the problem: 1 2 3 4 5 6 7 8 9 <?php $x = (0.1 + 0.7)*10; echo $x; //8 echo [...]
Overloading PHP functions
Being able to overload functions is a really useful ability of lots of programming languages including Java, C# and Perl including many others. Unfortunately, in PHP it is not built into the core functionality but it can be created with some thought and playing around with standard PHP features. So, what is overloading functions? Overloading [...]
Find previous and next row in MySQL
Next and previous buttons are used all over the web. There are many ways to do them and the differences of each situation lend themselves to different ways of doing them. I recently needed to find a way of finding the next and previous rows of a large MySQL table where I am not doing [...]
wordwrap – PHP function
The wordwrap function is a really useful PHP tool [php manual]. It splits a string into lines of a specified length and will insert a user defined line ending. This is a bit of a redundant use in web development as we should be using CSS to set column widths and text widths so we [...]
How to render Fusioncharts completely on the server
I recently had a need at work where I needed to render some nice looking charts and insert them into a pdf. I found Fusioncharts after a quick search and figured these charts look good, are easy to program and provide the functionality to output to an image which is perfect to insert into a [...]
How to write a WordPress plugin that uses flickr
So, I have written my first (good) WordPress plugin [here] so I thought I would go through how I went about it. I found working with WordPress really easy and intuitive to develop with. The Idea First and foremost with a WordPress plugin is to have a good idea that nobody else has had yet. [...]
Animating the address bar with replaceState
I read a blog post on the Mozilla Developer blog on the new HTML5 javascript pushState and replaceState methods here. They are to be used within AJAX web applications to alter the address bar and browser to allow improved usability and searchability for modern web applications. It struck me that this allows amazing new functionality and [...]
Extending objects using anonymous functions in PHP
Extending object in PHP has always required a new class to be created with the extensions and changes that are wanted. With the advent of anonymous functions (also called lambda functions or closures) in PHP 5.3, we can now extend our objects in the same way as can be done in javascript – at runtime [...]
5 Common Payment Gateway Mistakes
Payment gateways are now an easy way to take payment through the internet. There are a wide variety different gateways available (WorldPay, PayPoint, PayPal to name a few). There are really easy to implement and allow website owners to quickly and easily take payment securely and they leave the end user knowing their card details [...]
filter_var – PHP Function
This week I discovered a great new PHP function – it is going to make filtering user input so easier and everything much quicker. If you want to take a look at the php manual, take a look here. filter_var The function is to be used to check or filter user input against a range [...]
scandir – PHP Function
I discovered a new function in PHP this week – “scandir”. It is going to save a load of time dealing with filing systems – it’s the difference between fopen/fread/fclose and file_get_contents but for directories. The function is pretty simple really – it takes a single parameter, the name of a directory and returns all [...]


