| View previous topic :: View next topic |
| Author |
Message |
jhonynil
Joined: 13 Nov 2007 Posts: 102
|
Posted: Wed Jul 01, 2009 6:03 am Post subject: how to insert values in a array in loop |
|
|
If I am doing a .each and for every iteration of that .each I want to add a value into an array how would I go about doing that. I mean i can't do @array[] = new_value on every iteration, so i'm unsure
when i do this @array[] = new_value. it doesn't work. I end up with an array of 1 value
any help ??? |
|
| Back to top |
|
 |
umamahesh_nyros

Joined: 17 Jul 2007 Posts: 231 Location: KAKINADA
|
Posted: Wed Jul 01, 2009 6:04 am Post subject: |
|
|
you need to use append operator
@array << new_value
yea, $array[] = $new_value would work in PHP.
Thank You,
Uma. |
|
| Back to top |
|
 |
|