How can we extract string 'techinterviews.com' from a string
'http://www.techinterviews.com' using regular expression in PHP?
Answers were Sorted based on User's Feedback
Answer / rajeev raj karn
$url="http://www.techinterviews.com";
$url_part=split("w{1,3}[\.]",$url);
echo $url_part[1];
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ram
$url = "http://www.techinterviews.com";
$splittedstring = explode ("www.",$url );
$str = $splittedstring[1];
echo $str ;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sunil kumar
echo
strstr("http://www.techinterviews.com","techinterviews.com");
| Is This Answer Correct ? | 8 Yes | 9 No |
What is the main function of php?
How can I make a script that can be bilingual (supports english, german)?
What are the current versions of apache, PHP, and mysql?
How can i execute PHP File using Command Line?
Tell me how to strip whitespace (or other characters) from the beginning and end of a string?
Tell me is it possible to protect special characters in a query string?
What are access specifiers?
Which function is used in php to search a particular value in an array?
How to convert strings to numbers in php?
What is return value in php?
How to return ascii value of character in php?
Is php 5.6 secure?