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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I stop php artisan serve in windows?

504


What does the initials of php stand for?

537


What is the use of php and mysql?

558


What is html used for?

559


What is instantiation?

1748






Is wordpress a php framework?

523


Is php used for frontend or backend?

534


Differences between get, post and request methods ?

499


What are global variables in php?

504


What is __ construct in php?

543


What is use of in_array() function in php?

543


What is php good for?

511


How long should a session last?

514


What is the best way to test the strpos() return value in php?

534


Is rent a variable cost?

559