Re: [PHP] Dynamically assigning var namesi

2006-08-02 Thread Richard Lynch
On Tue, August 1, 2006 12:49 pm, bob pilly wrote: > Does anyone know if you can assign a new variable name based on the > contents of another variable in PHP? If so whats the syntax to do > this? You can and it's called Variable Variables in the documentation... 99% of the time, it's better to us

Re: [PHP] Dynamically assigning var namesi

2006-08-01 Thread Miles Thompson
At 02:49 PM 8/1/2006, bob pilly wrote: Hi all Does anyone know if you can assign a new variable name based on the contents of another variable in PHP? If so whats the syntax to do this? I am parsing a text file that has tens of preset attributes and some of these have hundreds of sub attri

Re: [PHP] Dynamically assigning var namesi

2006-08-01 Thread dpgirago
Bob Pilly asked earlier today: > Does anyone know if you can assign a new variable name based on the contents of another variable in PHP? If so whats the syntax to do this? $counter = 1; for ($i == 0; $i < 6; $i++) { ${'newVar_' . $counter} = $counter; $counter++; } echo $newVar_1 .

Re: [PHP] Dynamically assigning var namesi

2006-08-01 Thread Brad Bonkoski
Hi Bob, Based on what you said, I would say the normal coding way of handling this is with an array. If you are unfamiliar with them, www.php.net/array would be a good place to start. -Brad bob pilly wrote: Hi all Does anyone know if you can assign a new variable name based on the contents

[PHP] Dynamically assigning var namesi

2006-08-01 Thread bob pilly
Hi all Does anyone know if you can assign a new variable name based on the contents of another variable in PHP? If so whats the syntax to do this? I am parsing a text file that has tens of preset attributes and some of these have hundreds of sub attributes. For example the text file contains f