tel me any 2 regular expressions with example
Answer Posted / shyambabu
int ereg ( string $pattern , string $string [, array
&$regs ] )
Date Format:YYYY-MM-DD
if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date,
$regs)) {
echo "$regs[3].$regs[2].$regs[1]";
prints in dd.mm.yyyy format
} else {
echo "Invalid date format: $date";
}
string ereg_replace ( string $pattern , string
$replacement , string $string )
$num = '4';
$string = "This string has four words.";
$string = ereg_replace('four', $num, $string);
echo $string; /* Output: 'This string has 4 words.'
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is 'float' property in css?
What is trait in php?
Which database is best for php?
How do sessions work in php?
Explain the installation of PHP on UNIX systems?
What is php oop?
Explain me what is sql injection?
Who developed php?
Please explain is it possible to use com component in php?
Explain the changes in php versions?
How to set a page as a home page in a php based site?
Which framework is best for php development?
Explain what are some new features introduced in php7?
How to make database connection in php?
What is escaping to php?