Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: dynamically creating variable names


Message #1 by "Joel Wickard" <jwickard@l...> on Tue, 19 Jun 2001 16:41:27
That is why Nikolai (pardon me if I incorrectly remembered how your name was
spelled) had:

$$objectname = $basename . $i

You have the basename called MyObject so that as you loop through you'll
have:
MyObject1, MyObject2, etc.  You control the first characters so you know
their won't be a number in the name issue.  This way you can build loops to
run through your objects if you need to also.

Nikolia's sample code was very good and probably a good solution.

But yes, an array would probably do the same and would not be any
significant memory addition.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: <emmet.mccarthy@w...>
To: "professional php" <pro_php@p...>
Sent: Wednesday, June 20, 2001 6:00 AM
Subject: [pro_php] Re: dynamically creating variable names


> I never thought of that.I just tried it and you're right Sheila, it didn't
work. I suppose arrays are the answer, but
> someone said that already, I think.
> Emmet Mc Carthy
> WAYTOHERE GmbH(Programmierung)
> Schleißheimerstr. 41
> 80797 München
> Tel: (089) 12700888
> Fax: (089) 12700889
> e-mail: info@w...
>


  Return to Index