You are here: Re: When using foreach(), how to use &$value in php 4?? « PHP « IT news, forums, messages
Re: When using foreach(), how to use &$value in php 4??

Posted by "chris" on 12/20/05 17:02

......
""Scott Fletcher"" <scott@abcoa.com> escribiσ en el mensaje
news:C8.92.49905.DA160A34@pb1.pair.com...
>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--

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация