Basic PHP Programming Question: Download Questions PDF
How can we extract string abc.com from a string http://info@abc.com using regular expression of php?
Answer:
We can use the preg_match() function with "/.*@(.*)$/" as
the regular expression pattern. For example:
preg_match("/.*@(.*)$/","http://info@abc.com",$data);
echo $data[1];
the regular expression pattern. For example:
preg_match("/.*@(.*)$/","http://info@abc.com",$data);
echo $data[1];
Download PHP Interview Questions And Answers
PDF
Previous Question | Next Question |
Would you initialize your strings with single quotes or double quotes? | What is the difference between the functions unlink and unset? |