I have a section in my code looking like this:
$accounts[] = array("id" => 1, "fullName"=>"Lorem ipsum", "email"=>"lorem@example.com");
$accounts[] = array("id" => 2, "fullName"=>"Lorema ipsum", "email"=>"lorema@example.com");
$toUsers = array();
foreach($accounts as $account){
$toUsers[] = $account['fullName'] . "<" . $account['email'] . ">";
}
$toString = implode(", ",$toUsers);
This loop is supposed to give me a string, formatted like an email header (I want to use the mail function).
I expect the result to be $toString = "Lorem ipsum<lorem@example.com>, Lorema ipsum<lorema@example.com>"; but all I get is $toString = "Lorem ipsum, lorema Ipsum";
What do I need to do to get “<” and “>” working with a string in php?
Thanks, JNK
Outputting it to an HTML document are we? Chances are your browser’s interpreting it as markup. Check the view->source and see if it’s there.