Jump to content

Weird String happenings....


SharkBait

Recommended Posts

Ok I am trying to concat some strings together but its acting a bit odd and hopefully someone can explain to me why it is doing it.

 

<?php
$emails_addresses = array("thank you" => "[email protected]", "Kim" => "[email protected]", "Bob" => "[email protected]",);
$email_group = array( 0 => array("thank you", "Kim"), array("thank you", "Bob") );

$string = "";

foreach($email_group[0] as $person) {
  $string .= "{$person} <{$email_addresses[$person]}>, ";
}

?>

Now what that does it because of the < and > it seems to strip out the email addresses. If i put spaces between the < and > so it looks like

 

thank you < [email protected] > as opposed to thank you <[email protected]> it will show up, but I am curious why the < and > are stripping the email from the string.

 

I have also done it this way and the same thing happens:

 

<?php
$string .= $person . " <". $email_addresses[$person] .">, ";
?>

 

Am I missing some concept of strings?? Eventually this is what I want to have happen:

 

$string = "thank you <[email protected]>, Kim <[email protected]>";

 

:)

 

** Note: Why is it I type T y together it comes up as Thank you ?? I don't have any weird text replace macros running on my machine.

Link to comment
https://forums.phpfreaks.com/topic/66390-weird-string-happenings/
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.