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 |
How do I make a reset button in html?
How error handling is being handled by php?
What is the purpose of basename() function in PHP?
Do you know design patterns. List few?
How to create the PHP Script to Calculate the Age Using the Inputs Of our Birth date and the Current date?
What is PEAR?
Is php used in 2019?
How a constant is defined in a php script?
What is session in PHP. How to remove data from a session?
What is the difference between include and include_once ? Which is one is good in terms of performance ?
What is rtrim php?
How are variables declared in php?