generic cialis
Home » Archive

Articles in the PHP Category

PHP, Regular Expressions »

[24 Sep 2009 | No Comment | ]

Problem
I have a ton of date strings in the stupid US style dd/mm/yy format. i.e. 12/24/09 being 24th September 2009. I need to convert them to the UK style dd/mm/yy.
Solution 1
As a string in PHP is really just an array of characters, the simplest fix was to address the individual number characters by their positions within the sting, and rearrange them into the format I wanted:

$d = “12/24/09″;
$d = $d[3].$d[4].”/”.$d[0].$d[1].”/”.$d[6].$d[7];
echo $d; // displays “24/12/19″.

Solution 2
I posted my solution on twitter (@hutchings) and asked for comments and @londonhackspace organiser Jonty came …

PHP »

[5 Dec 2008 | No Comment | ]

Problem
When you’re using several domains which all point to one website, it’s important to make sure that Google only sees on domain when it’s crawling your site for content. Otherwise you’ll likely end up with ’suplemental result’ listings in the SERPS. At worst they’ll dump the site thinking it’s duplicating content.
A Solution
So what you need is something to intelligently redirect traffic to your preferred domain, while preserving any path and querystring data also. To do this with PHP you can place the following code (in an include maybe?) into the …