Gordonmac Dot Com

Mostly a web development blog

Category: PHP

Prettier PHP meter to feet/inches conversions

Posted: February 15th, 2011 | Tags: | Posted in: PHP, Tutorials

Whilst it’s fairly simple to convert meters to feet and inches using PHP the resulting conversion often looks rather complex and untidy. For example, most conversions will end up looking something like this: 12 meters = 39.3700 feet. This is not very pretty and looks overly complicated when …
Read more…

Recursive file deletion with PHP

Posted: February 18th, 2008 | Tags: | Posted in: PHP, Tutorials

This is a handy PHP function (I can’t remember where I found it) which performs a recursive deletion of every file in a given directory. I’ve been using it to periodically flush cache files created by my CMS on this site. function destroy($dir) { $mydir = opendir($dir); while(false …
Read more…

Getting the current URL with PHP

Posted: November 25th, 2007 | Tags: | Posted in: PHP, Tutorials

When I was creating the “Quick Navigation” page section I wanted to add as much helpful stuff as I could and place it in a readily accessible area of the layout. It contains a skip navigation link, a breadcrumb trail and a permanent link for easy bookmarking. The …
Read more…