Originally posted by Arakon
Ah I see, so the function cannot access a variable that isn't expressly passed to it? I was under the impression that a variable declared outside a function would be treated as a Global... hmm. Thanks.
Guess I'll have lookup on how to create/deal/manipulate Globals.
The point of the excercise was to practice OO coding on PHP. Its just a test to learn how it works differently than Java...
Interesting... variable scoping and return; statements works exactly the same in Java and C++ as it does in PHP ( minus C pointers and that crap ) which makes me wonder why you would be under this impression... but regardless, go read up on scoping in ANY programming book to get the idea.
Also, what you're doing isn't OO coding at all. Its procedural, you're writing FUNCTIONS, not OBJECTS...
Also for the record, there are very few cases you should really use references, they go against the idea of returning values and variable scoping which makes modern languages ( read: C, Java, PHP ) so great. global $var; delcarations and goto; statements fall under that same problem many times. References are there for a reason, and they should only be used in those cases when its really required. Otherwise, return $values; instead.