How can we extract string ?allinterview.com ? from a string
?http://info@allinterview.com? using regular expression of PHP?
Answers were Sorted based on User's Feedback
Answer / pinky
if (ereg("allinterview.com",
"http://info@allinterview.com", $temp) )
print $temp[0];
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / vipul dalwala
$string = "http://info@allinterview.com";
preg_match(@^(?:http://)?([^@]+)(.*)$@i', $string,
$matches);
print $matches[2]; // allinterview.com
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / raj
$text = "http://info@allinterview.com";
preg_match('|.*@([^?]*)|', $text, $output);
echo $output[1];
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / jcb.chl
<?
$str = substr('http://info@allinterview.com?',12);
echo $str;
?>
output:
allinterview.com?
Is This Answer Correct ? | 2 Yes | 6 No |
How to convert strings to numbers in php?
Tell us how to redirect a page in php?
What is advanced php programming?
What is data type in php?
How to pass variables by references?
What are the current versions of apache, PHP, and mysql?
what is abstrac class? why it is use?
Tell me how can we determine whether a php variable is an instantiated object of a certain class?
What are the functions for imap?
What does $_server mean?
hello experts good morning to everyone ! at present am now learning LAMP course sir( linux, apache,mysql and php) after finishing this course can i create my own website without investment is it possible ? please can any one tell sir and also tell me how can i upload my project after finishing the project in internet ? please tell the ways sir please send ur valuable suggestions to kiranpulsar2007@gmail.com
Which operator is used to combine string values in php?