PHP: invalid string not letting me compare it correctly

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.

Answers


My best guess is that $header['fromaddress'] is really something like

"Support Testing1" <blah@example.com>

And 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.


Need Your Help

API for manipulating audio output in windows 8

audio windows-8

I want to manipulate audio output data, for all the different running applications, before it is sent to the speakers.

Company mode (Emacs plugin) back-end could not be initialized?

plugins emacs

Every time I initiate company-mode with M-x company-mode this message shows up:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.