I have an html code which displays user email from php. However i want to trim this part @gmail.com And display the left part.
Currently I tried this code which is not working.
<p id="p1"><?php
$str = ""
echo $str . "<br>";
echo trim($str,"@gmail.com");
echo htmlspecialchars($_SESSION["username"]);
?></p>
What is the best way to correct it?
For example the email from php database is name1@gmail.com, i want to remove @gmail.com and display only name1