1

Parse error: syntax unexpected T_STRING on line 3.

<?php
class AttachmentEmail {
    private $from = '[email protected]';
    private $from_name = 'Site';
    private $reply_to = '[email protected]';
    private $to = '';
    private $subject = '';
    private $message = '';
    private $attachment = '';
    private $attachment_filename = '';
}
?>
4
  • 1
    I can't seem to reproduce the error-- it seems to be working for me. Commented Jun 22, 2012 at 20:52
  • 1
    I see no such error: codepad.viper-7.com/ILiA4A# Commented Jun 22, 2012 at 20:52
  • 7
    Are you using PHP 4 by any chance? That's valid PHP5 syntax, but not 4. Commented Jun 22, 2012 at 20:52
  • 1
    Wow, I thought it updated successfully to 5, arg.. Thanks! Commented Jun 22, 2012 at 20:54

1 Answer 1

2

You must be using PHP4. I just tried it in PHP 5.2 and it works just fine.

PHP 4 has a different set of rules for how a class is created versus version 5.

Run phpinfo(); to get your version. If it is version 4 you might want to consider upgrading.

Sign up to request clarification or add additional context in comments.

1 Comment

The crucial point here is that PHP4 has no private keyword.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.