PHP Preg_match

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shuhail
Forum Newbie
Posts: 16
Joined: Sun Jun 28, 2009 5:52 am

PHP Preg_match

Post by shuhail »

Code: Select all

  if( !preg_match("/^[0-9]{4}[-]{1}[0-9]{4}[-]{1}[0-9]{4}[-]{1}[0-9]{4}?$/", $abc) )
  { 
    $status = "failure"; 
  }
  elseif( substr($abc,10,1)*substr($abc,11,1)*substr($abc,12,1)*substr($abc,13,1) != substr($abc,15,4) )
  { 
    $status = "failure"; 
  }
  else
  { 
    $status = "success"; 
  } 
what does it means?
how could I find the value of $abc?

Thanks.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP Preg_match

Post by AbraCadaver »

Code: Select all

echo $abc;
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
jaceinla
Forum Commoner
Posts: 25
Joined: Thu Oct 14, 2010 12:57 pm

Re: PHP Preg_match

Post by jaceinla »

looks like it's a regular expression asking for

####-####-####-####
Post Reply