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

Are php session secure?

531


How to open a file in php?

622


What is urlencode and urldecode in php?

583


Which php framework is fastest?

512


Explain array_uintersect()?

591






Is php 7.0 stable?

513


How to download and install php for windows?

556


What is the difference between for and foreach in php?

502


What is parent __construct ();?

543


Define object-oriented methodology?

578


Explain the importance of the function htmlentities.

543


What are the benefits of using php?

519


What are the characteristics of php?

571


How to delete an element from an array?

559


How are variables declared in php?

558