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
List types of array are available in php?
How to set cookies in PHP?
How to remove html tags from data in php?
How to process the uploaded files?
Hi this is amul jani here, i complied my graduation in B.com stream.. but as career i looking for PHP language.. to get shape my career. so is that possible to enter in IT world.. for me how much scope of develop my career in this field.. amul jani
Do csrf tokens expire?
Define about declare construct?
Write down the benefits of php7?
Do you know how can we check the value of a given variable is a number?
How many keywords are there in php?
Tell me how to execute an sql query? How to fetch its result?
How many functions are there in php?
Tell me what is the importance of "action" attribute in a html form?
What does isset() function?
What is polymorphism php?