|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-09 18:08 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 16:00:01 2025 UTC |
Description: ------------ I've tried to predefine a variable inside a class as an instance of another class. The result was a parse error. Reproduce code: --------------- <?php class Foo { public $var = 1; } class Bar { public $obj = new Foo; public function __construct() { echo $this->obj->var; } } $a = new Bar; ?> Expected result: ---------------- 1 Actual result: -------------- Parse error: parse error in C:\wamp\www\try.php on line 7