I would like to get name from full email address and tried htmlentities and html_entity_decode but special character <
and >
gives issue to get the name. As full email address is coming from array (key-value) not as a string.
Array value:
Array
(
[ENV_MAIL] => "Project Bribara<project.bribara@gmail.com";
)
Tried code:
// Project email
$environment['ENV_MAIL'] = "Project Bribara<project.bribara@gmail.com";
$projectEmail = $environment['ENV_MAIL'];
echo $projectEmail ;
$projectName = explode("@", htmlentities($adminEmail));
echo html_entity_decode($projectName);
Expected:
"Project Bribara"
Actual:
"Project Bribara<project.bribara
How can I get the output as per expected?