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 does == mean in php?
Which character is used to match exactly one character?
Is php required for wordpress?
can we swap two different string using php for example:-- before swapping:-- 1 string :-hello friend, 2 string :-my dear, after swapping that strings will be: 1.hello dear, 2.my friend.
What is the purpose of php?
Do you know what is php?
What is $row in php?
So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?
Explain how is it possible to set an infinite execution time for php script?
How can we upload a file in php?
What is difference between required and require_once in php?
What does addslashes do in php?
What is php form validation?
What is the use of mysql_fetch_assoc in php?
Code to upload a file in PHP?