|
Posted by Andy Hassall on 11/06/98 11:22
On Tue, 26 Jul 2005 16:03:28 -0600, "Michael G" <mike-g@montana.com> wrote:
>> But you're not writing in other languages, you're writing in PHP where
>> it's
>> valid syntax, so where's the problem?
>
>Between my ears!!
>
>Just because the php interpreter doesn't barf doesn't necessarliy mean that
>it is defined behavior. I have ran across this before with different
>implementations of compilers, undefined behavior that is.
It's valid in Perl, and PHP's roots are in Perl :-)
The Objects page in the manual has an example of creating an object with just:
$cart = new Cart;
... no parens.
The definition of new (T_NEW) in Zend/zend_language_parser.y:425 (in PHP
4.4.0's source) looks to me like it accepts a variable - so "new $className" is
fine.
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|