kumaraswamy.dapa Posted July 28, 2011 Share Posted July 28, 2011 Hi all,I'am Kumara Swamy newer to the PHP World.... can any one tel me the use of '&' Symbol in php? i write a program by using strstr() function like below. <?php $st="kumar@techsoft.com"; $res=strstr($st,"@&srt.com"); echo $res; ?> Why I'm didn't get anything as a result? Quote Link to comment https://forums.phpfreaks.com/topic/243120-strstr-function-reg/ Share on other sites More sharing options...
WebStyles Posted July 28, 2011 Share Posted July 28, 2011 & is for referencing variables. what exactly are you truing to do? remove the @ and the domain name from the string? easiest way (to understand) is to use explode: <?php $st="kumar@techsoft.com"; $res=explode("@",$st); echo $res[0]; ?> Explode() breaks up your string where it finds the @ symbol, and returns an array with the parts. Quote Link to comment https://forums.phpfreaks.com/topic/243120-strstr-function-reg/#findComment-1248716 Share on other sites More sharing options...
AyKay47 Posted July 28, 2011 Share Posted July 28, 2011 because you needle does not match up to your haystack Quote Link to comment https://forums.phpfreaks.com/topic/243120-strstr-function-reg/#findComment-1248718 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.