A really weird string is being produced inside an array for some reason, and I don’t know how to treat it… I am getting the string and outputting it with the following code:
$server = '{imap.gmail.com:993/ssl}';
$connection = imap_open($server, 'myuser', 'mypass');
$count = imap_num_msg($connection);
$header = imap_headerinfo($connection, $i);
for($i = 1; $i <= $count; $i++) {
$from = $header['fromaddress'];
var_dump($from);
}
And this is the result I get from that var_dump:
string(39) "Support Testing1"
How is that possible? And is there any way I can convert that to the correct string (I mean, with the right length?)
This is affecting my code, because now:
echo ('Support Testing1' == $from)
gives me false, when it should be true. Any ideas? Thanks!
Update: trim is not working either.
My best guess is that
$header['fromaddress']is really something likeAnd you don’t see the email address in the var dump because the browser treats it like an HTML tag.
If this is so, then you need to remove the
<...>, and probably the double quotes as well.You can try viewing the source HTML to confirm.