How can we extract string 'techinterviews.com' from a string
'http://www.techinterviews.com' using regular expression in PHP?

Answer Posted / ram

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is incorrect with respect to separating php code and html?

534


How to remove html tags from data in php?

624


How do you count numbers in php?

495


What is form submission?

542


What is mvc php?

518






How can I find my php version?

540


What is the use of mysql_real_escape_string() function?

515


Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?

733


Do you know what is php?

550


What is php resource type?

530


What is array and function?

531


How does cookies work in php?

527


What is php default argument?

538


What is the function file_get_contents() useful for?

484


What is the difference between rest and soap?

565