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

Why ide is recommended for use while programming with php?

0 Answers  


what do you mean by php.ini file ?????????

2 Answers   Samsung,


Explain me how failures in execution are handled with include() and require() functions?

0 Answers  


How to uploaded files to a table?

0 Answers  


How would you impletement download and upload a file in php

2 Answers   A1 Technology,






Explain the types of string comparision function in PHP

0 Answers  


What is query string php?

0 Answers  


How to read a file in php?

0 Answers  


How to set session.gc_divisor properly?

0 Answers  


What is an array in php?

0 Answers  


Tell me how is the ternary conditional operator used in php?

0 Answers  


Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?

1 Answers   Rushmore Consultancy,


Categories