Re: When using foreach(), how to use &$value in php 4??

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

 



.....
""Scott Fletcher"" <scott@xxxxxxxxx> escribió en el mensaje 
news:C8.92.49905.DA160A34@xxxxxxxxxxxxxxx
>I have encountered a situation where I'm using the foreach() where I need 
>to
> assign new data to the $value in the foreach loop, foreach($x as $key ==>
> $value). With PHP 5, you can do the ampersand to the $value but I'm using
> PHP 4? So, how do you guys do it? I tried this sample code but it only 
> work
> in the child array but not the parent arrays...  Food for Thought??
> Thanks...
>
> --code--
> function XmlTreeCDataAsciiLoopThrough(&$tree)
> {
>   foreach($tree as $key => $value)
>   {
>      if (is_array($value)) {
>         XmlTreeCDataAsciiLoopThrough($value);
>      } else {
>         if ($key == "VALUE") {
>            echo $tree[$key]." ###<br>";
>            $tree[$key] = "#############";
>            echo $tree[$key]." @@@<br>";
>         }
>      }
>   }
> }
> --code-- 

-- 
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