Jump to content

strstr() function-reg


Recommended Posts

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="[email protected]";

$res=strstr($st,"@&srt.com");

 

echo $res;

 

?>

 

 

Why I'm didn't get anything as a result?

   

Link to comment
https://forums.phpfreaks.com/topic/243120-strstr-function-reg/
Share on other sites

& 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="[email protected]";
$res=explode("@",$st);
echo $res[0];
?>

 

Explode() breaks up your string where it finds the @ symbol, and returns an array with the parts.

Link to comment
https://forums.phpfreaks.com/topic/243120-strstr-function-reg/#findComment-1248716
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.