* Thus wrote Wouter van Vliet ([EMAIL PROTECTED]):
> Hi Folks,
>  
> I've been using the "passing arguments by reference" thingie for a while
> now. But what I want to do know is something I'm used to using in perl,
> returning a reference. 
>  
> Situation is as follows.
> 
>      19
>      20         function AddFoo() {

Need to let php know this is returning a reference:

    function &AddFoo() {
                    

>      21                 $Ref = &$this->Foos[];
>      22                 $Ref = new Foo();
>      23                 return $Ref;

I'm surprized this even works, its kind of confusing, i'd rather do
something like: 

    $foo = new Foo();
    $this->Foos[] = &$foo;
    return $foo;

>      26
>      27 $Bar = new Bar();
>      28 $Foo = $Bar->AddFoo();

And then let php know you want this as a reference:

    $Foo = &Bar->AddFoo();


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to