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 the use of mysql_fetch_array in php?
What is the most common http method?
Why does php need server?
What is $globals php?
How would you declare a function that receives one parameter name hello?
Is it more secure to use cookies to trfer session ids?
What is variable give example?
What is the purpose of $_ session?
Is php pass by reference or value?
how to track user logged out or not? when a user is idle?
What does sign mean php?
Write a program to find a string is palindrome or not?
How long do php sessions last?
Does php have a future?
Is set in php?