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 |
What is php and its advantages?
What is $_ env in php?
How to copy a file?
What is __ construct in php?
What is the meaning of a persistent cookie?
So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?
What are encryption functions in php?
How do you run a php script from the command line?
Explain about Functions in PHP?
How can we upload a file in php?
What is php variable?
How do you execute a php script from the command line?