Problems on PHP5 object instantiation
| From: | Jingcheng Zhang | Date: | Thu, 18 Jan 2007 14:06:11 +0000 |
| Subject: | Problems on PHP5 object instantiation | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-27518@lists.php.net to get a copy of this message | ||
Hi,
I'm now trying OOP in PHP5, and enjoy it very much. However, as we know
PHP5 does not allow compile-time instantiation,
so when I try this script:
<?php
class C {
static private $o = new stdClass();
}
?>
it ends up with a parse error, while in Java it works naturally. I wonder
whether there are some difficulties on implementing this
feature, or, is it just not the natural way? Thanks :)
--
Best regards,
Jingcheng Zhang
Room 304, Dormitory 26 of Yuquan Campus, Zhejiang University
P.R.China