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



How can we extract string 'techinterviews.com' from a string 'http://www.techintervi..

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

How can we extract string 'techinterviews.com' from a string 'http://www.techintervi..

Answer / ram

$url = "http://www.techinterviews.com";
$splittedstring = explode ("www.",$url );
$str = $splittedstring[1];
echo $str ;

Is This Answer Correct ?    0 Yes 0 No

How can we extract string 'techinterviews.com' from a string 'http://www.techintervi..

Answer / sunil kumar

echo
strstr("http://www.techinterviews.com","techinterviews.com");

Is This Answer Correct ?    8 Yes 9 No

How can we extract string 'techinterviews.com' from a string 'http://www.techintervi..

Answer / brett

echo str_ireplace('http://www.','',$url);

Is This Answer Correct ?    3 Yes 8 No

Post New Answer

More PHP Interview Questions

What is ci in php?

1 Answers  


What is meant by pear in php? What is the purpose of it?

1 Answers  


What is the function used to change the root directory in PHP?

1 Answers  


What is session cookies php?

1 Answers  


Name some of the popular frameworks in php.

1 Answers  


What's the difference between using mysql_ functions and pdo?

1 Answers  


What is the difference between explode and split?

1 Answers  


Which PHP function would you use to send an email?

1 Answers  


What is php destruct?

1 Answers  


What is a stored procedure in mysql?

1 Answers  


What is difference between required and include in php?

1 Answers  


•How can we submit a form without a submit button

5 Answers  


Categories