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 |
Explain scalar type declarations in php7?
What is strlen php?
List the different types of print functions available in php?
What is the importance of parser in php?
write function of the sentence traversal passing the parameter, e.g input:this is input sentence. output:sentence input is this.
What is the use of return in php?
What is polymorphism in php?
Which Scripting Engine PHP uses?
What is the php function that removes the first element of the array and returns it?
How to receive a cookie from the browser?
What is the meaning of a final class and a final method?
Is overloading possible in php?