![]() Preserved Topic: php eval() question (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Manassas VA, USA |
![]() I'm trying to use eval within a class to set a global variable. I can't get the syntax just right. |
Bipolar (III) Inmate From: dk's house of love |
![]() Ok I am not an expert but can't you declare the varible outside the function and then you are able to use it globally. This is the way its done in javascript at least. Here's how i'd do it in js: |
Nervous Wreck (II) Inmate From: Manassas VA, USA |
![]() That would work for setting up a global var, so what I think I need now is to set it up as an array, then in my loop, just set up everything in the array. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() dk, you can't do that with PHP as you can in JS (actually JS is one of the few languages that let's you do that) With PHP you need to use "global varname" within your function to bring in a variable set outside the scope of the function. |
Nervous Wreck (II) Inmate From: Manassas VA, USA |
![]() I actually just figured it out... |