syntax error in class
| From: | Dasn | Date: | Thu, 11 Feb 2010 06:13:39 +0000 |
| Subject: | syntax error in class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-301983@lists.php.net to get a copy of this message | ||
Hello guys, I encountered a syntax error, and cannot figure out the reason, for example:
============================== CODE ==============================
1:<?php
2:$opts = array ('header'=>'str1'.'str2');
3:?>
===============================
Works fine, but when I try to put it into a class, say:
============================== CODE ==============================
1:<?php
2:class Test
3:{
4: var $opts = array ('header'=>'str1'.'str2');
5:}
6:?>
============================== OUTPUT ==============================
Parse error: syntax error, unexpected '.', expecting ')' in C:\Documents and Settings\Administrator\Local Settings\Temp\VI42E5.tmp on line 4
PHP Parse error: syntax error, unexpected '.', expecting ')' in C:\Documents and Settings\Administrator\Local Settings\Temp\VI42E5.tmp on line 4
====================================================================
I got the syntax error. Why?
My php version:
D:\>php -version
PHP 5.3.1 (cli) (built: Nov 19 2009 10:17:43)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
I'm currently not on this list, please Cc your comment to me.
Thanks in advance.
--
Dasn