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 |
How do I run a php program in dreamweaver?
What is return value in php?
Tell me how to strip whitespace (or other characters) from the beginning and end of a string?
What is array filter in php?
How to invoke a user function?
What type of comments are supported by PHP.
What is MVC structure in Magento?
List out different arguments in PHP header function?
Explain scalar type declarations in php7?
Explain me how failures in execution are handled with include() and require() functions?
How can I use the COM components in php?
1 Answers Covansys, Rushmore Consultancy,
what is used for tmp table in oracle?