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
Which is better python or php?
discuss the issue of software theft in ghana and how it has affected the economy
Can we use get instead of post?
What is ci framework in php?
Distinguish between urlencode and urldecode?
What is url encoding and decoding in php?
Where php language is used?
How to get length of an array in PHP?
What is htaccess? Why do we use this and where?
How can I display text with a php script?
Which programming language does php resemble to?
What are the new features available in php 7?
Do while loops?
How values in arrays are indexed?
Why did you choose this particular career path?