Re: Tree-like structure in PHP?

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

 



On 16/11/2007, Paul van Haren <paul.vanharen@xxxxxxxxx> wrote:
> I'm trying to use arrays to implement a sort of data tree. For the code to
> work, it is essential that the nodes can be edited after they have become
> part of the tree. That would require that the array elements are pushed
> "by reference" rather than "by value".
>
>         <?php
>
>         $arr1 = array ();
>         $arr2 = array ();
>
>         array_push ($arr1, 1);
>         array_push ($arr1, $arr2);      // <-- the important line

         array_push ($arr1, &$arr2);
or
         $arr1[] =& $arr2;

-robin

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux