Re: Variable variables and references

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, March 10, 2007 6:28 am, Dave Goodchild wrote:
> Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I
> think
> it's a great book, I am confused about variable variables and
> references -
> not the mechanics, just where you would use them.
>
> The subject of variable variables is explained but no examples are
> given as
> to why and where you would utilise them.

99% of the time, using variable variables means you screwed up and
should have used an array. :-)

The 1% remaining is something that should be attempted only by
experts, so you'll know when you get there that you need it.

> As for references, the examples given with regard to passing and
> returning
> by reference in functions is clear, but no real examples are given as
> to
> when this would be a preferred approcah - in fact, the authors stress
> that
> due to PHP's copy-on-write mechanism, it is not a frequently-used
> approcah.

In PHP5, the whole reference thing changed all around.

What version is the book targetted at, and what version are you running?

> So my question - are there any 'classic' situations in which either
> should
> be used, and where and when do you guys use them in your real-world
> efforts?

I don't even use OOP in PHP, much less &OOP.

I only used variable variables when I was young and foolish.

Well, younger and more foolish.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux