Re: How to a list link?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Probably he's talking about linked lists ... If so an approach in php
> would be the OO one:
>
> class List {
>
>  var previous;
>  var next;
> var contents;
>
>   function List ( $p, $n, $c) {
>    $this->previous = $p;
>    $this->next = $n;
>    $this->contents = $c;
> }
>

PHP is different than C, when you do:
$this->previous = $p
you get 2 differents objects. The original is $p and the new one on
$this->previous.
If you change $p, $this->previous will not be changed.

you must do something like:

   function List ( &$p, &$n, $c) {
     $this->previous &= $p;
     $this->next &= $n;
     $this->contents = $c;
   }

to get the same object in both places... But I'm not sure...

-- 
José Miguel Santibáñez
    jms@xxxxxxxxx


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux