ncw
asked on
Syntax used with ereg
Could someone explain the following code in English please:
$validFormat = ereg("^(3[0-9]{4}|2131|180 0)[0-9]{11 }$", $this->__ccNum);
The code is validating a JCB type credit card number. I've read an explanation for the function ereg at http://www.phpbuilder.com/manual2/manual/fi/function.ereg.php , but I'm looking for a bit more help.
eg how does this work: "^(3[0-9]{4}|2131|1800)[0- 9]{11}$"
what does ^ mean?
I think | = or
The valid format for JCB is:
1. prefix = 3 and lenght = 16 or
2. prefix = 2131 or 1800 and length = 15
$validFormat = ereg("^(3[0-9]{4}|2131|180
The code is validating a JCB type credit card number. I've read an explanation for the function ereg at http://www.phpbuilder.com/manual2/manual/fi/function.ereg.php , but I'm looking for a bit more help.
eg how does this work: "^(3[0-9]{4}|2131|1800)[0-
what does ^ mean?
I think | = or
The valid format for JCB is:
1. prefix = 3 and lenght = 16 or
2. prefix = 2131 or 1800 and length = 15
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.