note 73947 deleted from function.imap-open by didou

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: dsthomas at gmail dot com 

----

In reference to not being able to use $var in the server string:

Because of the way the complex string expansion works, you would have to use a pair of { at the beginning (and if you were doing this for another reason, e.g. an echo, a pair of } at the end).  It's the combination of the { and the $ in the beginning that is causing PHP 4 & 5 to "eat" the first {.  Also, do not forget to end the expansion point with } after the variable name.

<?php
      $svr = 'mail.myserver.com';
      $rs = imap_open("{{$svr}:143}INBOX", 'user_id', 'password');
?>

References:

See the complex string expansion section on http://www.php.net/manual/en/language.types.string.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.