View Single Post
Old 11-14-2012, 01:34 PM   PM User | #6
LearningCoder
Regular Coder

 
LearningCoder's Avatar
 
Join Date: Jan 2011
Location: The Pleiades
Posts: 849
Thanks: 67
Thanked 28 Times in 28 Posts
LearningCoder is an unknown quantity at this point
Quote:
Originally Posted by firepages View Post
good point, ok thinking about it regex is probs the way to go

PHP Code:
$str='0337890- h 345645';
$str preg_replace("/\D/","",$str);  
if(
$str[0]=='0' && strlen($str)==13){
  echo 
'ok';

I'll have a play around with that code and read up on preg_replace(). Regular Expressions are complicated to understand. Tried using an example code someone gave the other day so thought I'd read up on it.

Can't find any good documentation anywhere for detailed explanations etc.

Kind regards,

Lc.
LearningCoder is offline   Reply With Quote