You are viewing...

So I ran into this PHP issue with Static variables

Updated on February 27, 2013 at the 23th hour
Posted under:

DISCLAIMER: Expressed views on this blog are my own.

The above link has a great example of what I want trying to do. I was trying to assign static variables in a subclass that inherited it's static variables from a base and turns out that doing that changed the static variables inside of the base, which is a huge problem for what I was doing. There are many classes that inherit from this one base class, so one screw up like that and things go awry everywhere.

The problem is that static variables are inherited as a reference and to solve this issue you need to re-declare the variables in the class with the assignment.
You just read "So I ran into this PHP issue with Static variables". Please share if you liked it!
You can read more recent posts here.