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 |
Which php mvc framework is best?
What PHP stands for?
What library is used for pdf in php?
What is namespace and use in php?
What are the uses of explode() function?
What are the advantages of stored procedures, triggers, indexes in php?
What is the difference between characters 34 and x34?
What does isset() function?
How to delete an element from an array?
What is the difference between nowdoc and heredoc?
What is the difference between the functions unlink and unset?
How can you insert javascript in php code?