Parse error while using imap_open

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Parse error while using imap_open

Post by impulse() »

I'm created a small webmail system that allows me to login to a mailbox and retrieve e-mail messages. The following line is giving me a parse error of:
PHP Parse error: syntax error, unexpected ':', expecting '}' in /var/www/html/php/test/email.php on line 15
while indicates a problem with this line:

Code: Select all

$mbox = imap_open("{$server:110/pop3}INBOX", "$username", "$password");
Could somebody point out an error with that please?

The login details are submitted to PHP through a form.

Stephen,
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

{ and } may have a special meaning in double-quoted strings, see http://de2.php.net/language.types.strin ... ng.complex
and you have triggered that special meaning by using a variable directly after the opening {, i.e. {$var
Post Reply