note 106218 added to language.types.object
| From: | razvan_zarzu at yahoo dot com | Date: | Wed, 19 Oct 2011 14:46:32 +0000 |
| Subject: | note 106218 added to language.types.object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183997@lists.php.net to get a copy of this message | ||
In PHP 5.3.6, even if the following code doesn't have any apparent syntax errors:
<?php
class Test {
public $a = SplFixedArray::fromArray(array());
}
?>
, the result is:
Parse error: syntax error, unexpected '(', expecting ',' or ';' in
~\test.php on line 3
This is because on an implicit object initialization of $a, which is not allowed in PHP.
Hope this helps someone.
----
Server IP: 69.147.83.197
Probable Submitter: 109.99.230.8
----
Manual Page -- http://www.php.net/manual/en/language.types.object.php
Edit -- https://master.php.net/note/edit/106218
Del: integrated -- https://master.php.net/note/delete/106218/integrated
Del: useless -- https://master.php.net/note/delete/106218/useless
Del: bad code -- https://master.php.net/note/delete/106218/bad+code
Del: spam -- https://master.php.net/note/delete/106218/spam
Del: non-english -- https://master.php.net/note/delete/106218/non-english
Del: in docs -- https://master.php.net/note/delete/106218/in+docs
Del: other reasons-- https://master.php.net/note/delete/106218
Reject -- https://master.php.net/note/reject/106218
Search -- https://master.php.net/manage/user-notes.php