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 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

What are the security measures we have to take for our site not to hack by others?

1 Answers   Infosys,

How can we destroy the session, how can we unset the variable of a session?

5 Answers  

> symbol is used to redirect the output of a command. State Whether True or False?

0 Answers  

why we used type-pool SLIS in ALVs? how many types of windows in scripts?

0 Answers   IBM,

What is MIME?

2 Answers  

How to generate pdf file in php?

1 Answers  

How can we know that a session is started or not?

8 Answers  

How can we extract string '' from a string '' using regular expression in PHP?

4 Answers  

What are the features and advantages of object-oriented programming?

5 Answers   HCL,

What is meant by MIME?

0 Answers  

hi abinashg i think u have experience in php plz tell me more about php now i raearlly want to do php wat is the email id guide me thanks...........

2 Answers  

when you will get the message/error "headers already sent"?

5 Answers