tel me any 2 regular expressions with example



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

Post New Answer

More PHP Interview Questions

How to process the uploaded files?

0 Answers  


What is list in PHP?

0 Answers  


What is the purpose of php?

0 Answers  


Why php is used?

0 Answers  


What is htaccess?

1 Answers  






Is wordpress a php framework?

0 Answers  


Are php short tags acceptable to use?

0 Answers  


What is the w3c?

0 Answers  


How does php strcmp work?

0 Answers  


Why sessions are used in php?

0 Answers  


Explain some of the php array functions?

0 Answers  


Why do we use javascript in php?

0 Answers  


Categories