How can we extract string 'abc.com' from a string
"http://info@abc.com" using regular expression of PHP

Answer Posted / gaurav

you can use array split
$site_arr=split("@", "http://info@abc.com");
$site_name=$site_arr[1];

$site_name will have the value abc.com.

Is This Answer Correct ?    10 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is $_ request in php?

491


What Is a Persistent Cookie?

605


What is difference between echo and print in php?

488


What is strcmp?

513


Which is true about the singleton design pattern?

547






Do you know what is the difference between mysql_fetch_object() and mysql_fetch_array()?

514


How do you sort an array in php?

519


What is the difference between the functions strstr() and stristr()?

532


How to avoid the undefined index error?

504


How to access a Static Member of a Class in PHP?

509


What is a substring in php?

566


What are php keywords?

529


How to count all the lines of code in a directory and sub folder?

506


Explain the importance of the function htmlentities.

537


What are the different opening and closing tags available in PHP?

569