tel me any 2 regular expressions with example
Answer / 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 |
Describe which programming language does php parallel to?
What is the purpose of using php?
When do sessions end?
What is the use of stripslashes in php?
Is strcmp case sensitive?
What are the php variables?
Write a PHP code to print following number pattern: 123 456 789
What is MIME?
What is difference between mysqli and mysql?
what is the dirrence in PHP4 & PHP5 . ?
Which is better mysql or sql?
In mail($param1, $param2, $param3, $param4), the $param2 contains__