How to strip out UK postcode segments using PHP
Published in Blog by Adam Williams / 0 CommentsHere’s a quick bit of code I put together to read a UK postcode and spit out the various sections; the city identifier, the area and then the final street identifier: $pcarr = explode(‘ ‘, $this->input->post(‘companyPostcode’)); $pc0 = $pcarr[0]; if(is_numeric(substr($pc0, 1,1))){ $pca = substr($pc0, 0,1); } else { $pca = substr($pc0, 0,2); } // $pca [...]
Continue Reading -»Leeds Guide website development
Published in Web Design & Development by Adam Williams / 0 CommentsI developed additional functionality for both the front end and back end of the Leeds Guide website, using XHTML, PHP (Codeigniter) and Jquery and custom Javascript to enhance the UI.
Continue Reading -»Developed Leeds Guide Bespoke Publishing / CRM Platform
Published in Featured, Web Design & Development by Adam Williams / 0 CommentsCalculate the distance between two sets of coordinates using JavaScript
Published in Blog by Adam Williams / 0 CommentsHere’s some code which allows you to calculate the distance in miles, kilometres or nautical miles between two sets of coordinates: [code lang="js"]/* Function Name: distance() Function Description: Calculates the distance between two sets of coordinates. @Author: Adam Williams <adam.williams@awdigital.eu> @License: Creative Commons Attribution-Share Alike 2.0 UK: England & Wales - http://creativecommons.org/licenses/by-sa/2.0/uk/ @Example: distance(53.61857936489517, -1.4501953125, [...]
Continue Reading -»How to set error level and output in PHP
Published in Blog, Uncategorised by Adam Williams / 0 CommentsYou can set the error reporting level in PHP and also define whether it is displayed to the user or saved to a log file. The level can be defined either in the php.ini, .htaccess or directly inside a PHP script. The logging level options are: E_ALL – will log every error, including notice messages [...]
Continue Reading -»