- 24 Jul 2011
-
I recently had a project that needed to validate Irish mobile phone numbers. Here is the PHP function I used in case anyone needs to do the same again.
The function returns FALSE if the number is not in a valid format or else it returns the mobile number in the format 003538XXXXXXXX. It can deal with odd formated numbers such as (086) 1234123, +353861234123 etc.
function validate_number($number) { $number = preg_replace('/\D/', '', $number); //Strip all non numeric characters $length = strlen($number); // Strip the 00353, 353 or 0 from the start of the number if ($length == 10) // 08XXXXXXXX { $number = substr($number, 1); } elseif ($length == 12) // 3538XXXXXXXX { $number = substr($number, 3); } elseif ($length == 14) // 003538XXXXXXXX { $number = substr($number, 5); } else // Not a valid number { return FALSE; } if (preg_match('/8\d{8}$/', $number)) { //Number must have an '8' followed by eight other digits i.e. 8XXXXXXXX return $number; } else // Not a valid number { return FALSE; } } - 27 May 2011
-
- 06 May 2011
-
Trinity Orchestra plays Daft Punk
-
Lisa Hannigan – “Just like Tom Thumb’s blues” Live in Dick Mac’s in Dingle.
- 28 Apr 2011
-
The north face was first climbed on July 24, 1938 in three days. Ueli Steck set the record for climbing it in 2 hours 47 min.
- 27 Apr 2011
-
“Marc Newson’s latest creation for Ikepod sees the Australian designer interpret the most iconic timepiece of all: The Hourglass. Director Philip Andelman traveled to Basel, Switzerland, to document the designer’s modern take of the classic hourglass inside the Glaskeller factory. Each hand made hourglass comprises highly durable borosilicate glass and millions of stainless steel nanoballs, and is available in a 10 or 60 minute timer.”
(via Ikepod.com)
- 26 Apr 2011
-
ReCaptcha and DuoLingo. Solving big tasks one word at a time.