Ereg
(PHP3, PHP4)
Ereg---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Formal expression comparison
Syntax: int ereg (string pattern, string string [, array regs])
Description:
Search string to show the normal representation of pattern.
If a match is found, the third parameter regs is called, and the result of the comparison is stored in the regs element, $regs [1] is a partial string that conforms to the first left bracket (parenthesis), $regs [2] is a partial string that conforms to the second bracket, and so on, $regs [ 0] is an argument string.
If Ereg () finds the alignment, the $regs is filled with 10 elements, even if it is more than or less than 10 parentheses, and can be compared, which does not affect the ability of ereg () to compare to more partial strings. If you do not, $regs will not be ereg () change.
Search is case-sensitive.
Returns True if the string is more than pattern, and returns false if it is less than or if an error occurs.
The following example cuts the date format yyyy and displays it as a DD.MM.YYYY format.
Example:
<?php
if (Ereg ([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $date, $regs)) {
echo "$regs [3]. $regs [2]. $regs [1]";
}
else {
echo "Invalid date format: $date";
}
?>
Reference: Eregi () ereg_replace () eregi_replace ()