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 |
Write a hello world program using variable?
Write a program in php to find the occurrence of a word in a string?
Which is the dependent variable?
What is the difference between explode () and split () functions in php?
What is php pathinfo?
what is the importence of session.save_path in Php.ini file and wht changes u've to made before using sesssions in ur php program first time?
What is a stored procedure in mysql?
Without using forms and hidden variables, how to send variables from a PHP script to another URL using POST method?
How to write in a file in php?
Where are sessions stored php?
What is delimiter php?
What are the different loops in php?