[Tutor] GoFish
Erik Price
erikprice@mac.com
Sun, 12 May 2002 17:56:30 -0400
On Sunday, May 12, 2002, at 05:44 PM, dman wrote:
> This isn't
> to say that eval() is never useful, just that dynamically creating
> variable names is not considered good programming practice.
That makes sense, and I felt guilty doing it -- but the situation
warranted it. I was writing server-side PHP code that would generate
client-side JavaScript code to be echoed to an HTML document. (This
gets pretty complicated, because it requires some characters to be
escaped multiple times [from both JavaScript AND php].) Since variable
names cannot be passed directly from PHP to JavaScript (you basically
have to echo the JavaScript code you want), I had to do it this way.
Erik