Page 1 of 1

OOP PHP4

Posted: Tue Feb 15, 2005 11:12 pm
by technics
Hi coders,

Can somebody recommend a good OOP PHP4 tutorial website?

Also a question; if PHP4 passes variables by value not reference then that means memory unit(s) is allocated each time we pass a variable. When the focus changes from function A to function B, what happens to the variable in function A? It still stays there I assume - using up memory?
Now say function B has finished - what happens to the variables within? is it in memory still?

I need a good OOP website for PHP4 too!

Posted: Tue Feb 15, 2005 11:24 pm
by feyd
it may be easier to find OOP information in general.

As for variable passing, yes function A keeps its variables on the stack. When function B terminates, all variables (except static ones) are unallocated. PHP uses smart memory management. Meaning that garbage collection is performed for you, most of the time. In 4, you can most often, pass variables by reference.