Write a PHP script to extract the user name from the email ID

strstr():-

The strstr() function searches for the first occurrence of a string inside another string.


code:-

<?php
$emailid  = 'helloworld@gmail.com';
$username = strstr($emailid, '@', true);
echo $username."\n";
?>

output:-

helloworld

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post