You are here: Re: new Object()->function() ? « PHP Programming Language « IT news, forums, messages
Re: new Object()->function() ?

Posted by Mtr on 10/01/07 13:49

On Mon, 01 Oct 2007 15:41:35 +0200, Willem Bogaerts
<w.bogaerts@kratz.maardanzonderditstuk.nl> wrote:

>(new Object())->function()
>
>Mtr wrote:
>> this results in "unexpected T_OBJECT_OPERATOR" Parse error
>>
>> How do I do this, without needing two lines such as
>>
>> $o = new Object();
>> $o->function();
>>
>> Also, what does "unexpected T_OBJECT_OPERATOR" mean?
>
>It means that the -> is unexpected at that point.

Yes, thanks, but more precisely: the "->" is not an operator, nor is it
text. (I assume that "T" is short for text.) So it's unclear what this
error msg means.

Let me refine my example, so as not to use any reserved word like
"function"

$o = new MyObject()->myFunction() does not work:

If I know what the error means, it will be easier to remember.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация