Re: [PHP] making changes on arrays

2004-04-30 Thread Justin Patrin
Travis Low wrote: Hi Katie, The foreach construct operates on copies of the array values. I usually just stick to C-like syntax: for( $i = 0; $i < count( $array ); $i++ ) { $array[$i] = doSomething( $array[$i] ); } Remember that this will only work for consecutively integer indexed arrays

Re: [PHP] making changes on arrays (SOLVED)

2004-04-29 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > > cheap webhosting only 8.25 U$ dollar a month for 400 MB and bandwith 5 GB > transfer I think you're lost. You obviously don't know what you're doing. Curt -- I was working on a flat tax proposal, and I accidentally proved there's no god

Re: [PHP] making changes on arrays (SOLVED)

2004-04-29 Thread RoyD
[EMAIL PROTECTED]> cc: 04/30/2004 11:46 AM Subject: Re: [PHP] making changes on arrays

Re: [PHP] making changes on arrays

2004-04-29 Thread Curt Zirzow
* Thus wrote Katie Marquez ([EMAIL PROTECTED]): > I want to have an array, perform an action on the > values in the array, and have those actions > permanently affect the values in the array. Here's > something I've written to test it out how I thought it > could be done: > > $array = ('zero

Re: [PHP] making changes on arrays (SOLVED)

2004-04-29 Thread Katie Marquez
Very cool, Travis! Thank you for answering so quickly! You guys work fast around here :) Katie --- Travis Low <[EMAIL PROTECTED]> wrote: > Hi Katie, > > The foreach construct operates on copies of the > array values. I usually just > stick to C-like syntax: > > for( $i = 0; $i < count( $arr

Re: [PHP] making changes on arrays

2004-04-29 Thread Richard Harb
Hi, that's something I tripped over myself when I started out :) foreach takes one element after another from the array and copies it into that new variable - in your case $value ... you can modify it all you want - the value 'still' being in the array will not be affected. you could operate di

Re: [PHP] making changes on arrays

2004-04-29 Thread Travis Low
Hi Katie, The foreach construct operates on copies of the array values. I usually just stick to C-like syntax: for( $i = 0; $i < count( $array ); $i++ ) { $array[$i] = doSomething( $array[$i] ); } cheers, Travis Katie Marquez wrote: I'm practicing from a beginning PHP book regarding array

[PHP] making changes on arrays

2004-04-29 Thread Katie Marquez
I'm practicing from a beginning PHP book regarding arrays and the PHP manual, so please no one flame me that I didn't try to research before posting. I'm thinking that what I want to do requires me to use the function array_walk or a foreach loop, but I'm not so sure so maybe someone help here can