Ask a Question related to PHP Development, Design and Development.
-
Phil Roberts #1
Re: chaining of -> operator
With total disregard for any kind of safety measures Chris Laird
<chris@SPAM.pocketGUARDfluff.net> leapt forth and uttered:
PHP4 doesn't support the usage of $obj->one()->two()> I'm getting a parse error using -> to refer to a method of an
> object that is returned from a method call.
>
> Example code:
>
> class A {
> function &getB() {
> return new B();
> }
> }
>
> class B {
> function two() {
> return 2;
> }
> }
>
> $a = &new A();
> //all of these cause a parse error:
> echo $a->getB()->two();
> echo ($a->getB())->two();
> echo ${a->getB()}->two();
>
> //using an intermediate variable works fine:
> $b = &$a->getB();
> echo $b->two();
>
>
>
> Can anybody help me out with the correct syntax here? I must be
> missing something simple surely.
>
>
> chris
>
I think PHP5 will allow this behaviour though.
--
There is no signature.....
Phil Roberts Guest
-
Chaining live video stream
:beer; Hello : I have a problem of server side "Stream class" and rebublish live video stream. In brief, I assume the live video stream can... -
Chaining streams between 2 media server
Hi i'm trying to setup a stream chaining between 2 flash media servers. Basically I have an swf that streams my camera to FS Server 1. In FS... -
Is it possible to predetermine the order of HttpModule calls or implement filter chaining in ASP.Net
Hi people, I am wondering if it is possible to pretermine the order of the HttpModules being executed. If not, how can one implement interceptor... -
operator
Hello, I would like to known if it is possible to implement operator like + += etc like we can do in c++. class object { object&... -
chaining comparisons
When I learned python I was overjoyed that I could evaluate 1 < 2 < 3 and get "true". I just realized that you can't do that in Ruby. Is there a... -
Louis-Philippe Huberdeau #2
Re: chaining of -> operator
Phil Roberts wrote:I confirm that one. I just love that feature.> With total disregard for any kind of safety measures Chris Laird
> <chris@SPAM.pocketGUARDfluff.net> leapt forth and uttered:
>
>>>>I'm getting a parse error using -> to refer to a method of an
>>object that is returned from a method call.
>>
>>Example code:
>>
>>class A {
>> function &getB() {
>> return new B();
>> }
>>}
>>
>>class B {
>> function two() {
>> return 2;
>> }
>>}
>>
>>$a = &new A();
>>//all of these cause a parse error:
>>echo $a->getB()->two();
>>echo ($a->getB())->two();
>>echo ${a->getB()}->two();
>>
>>//using an intermediate variable works fine:
>>$b = &$a->getB();
>>echo $b->two();
>>
>>
>>
>>Can anybody help me out with the correct syntax here? I must be
>>missing something simple surely.
>>
>>
>>chris
>>
>
> PHP4 doesn't support the usage of $obj->one()->two()
>
> I think PHP5 will allow this behaviour though.>Louis-Philippe Huberdeau Guest



Reply With Quote

