[nycphp-talk] $$ question
Andrew Yochum
andrew at plexpod.com
Wed May 25 22:51:12 EDT 2005
On May 25, 2005, at 9:22 PM, Peter Sawczynec wrote:
> Man, I gotta party after that round. But seriously I think variable
> variables belongs "forever in the dog pound". So streamlined and
> clean --
> like looking at a Bang & Olufsen. Why have five moving parts when
> you only
> need two or none.
I agree. There is a time and place for variable variables and they
are few and far between. One appropriate scenario is when using the
reflection APIs, for instance. With what info we had about the
scenario originally in question, I don't feel that is a case where I
think they are appropriate.
As an alternative solution, personally I'd would have reworked it to
use a 3 dimensional array, even if the first dimension was small.
$concerts[$year][$i][$field]
No need for variable variables. Either way its a hash lookup -
either in the symbol table or the associative array. I'm sure
someone out there may know if there is a difference between those in
PHP - I don't off the top of my head. Regardless of what the
difference might be, I think the array is a better solution overall
for clean code with the least exposures.
Andrew
--
Andrew Yochum
Plexpod
andrew at plexpod.com
718-360-0879
More information about the talk
mailing list