Author Topic: PHP Scope Oddness, Getting Around?  (Read 1873 times)

anphanax

  • Member
  • **
  • Posts: 197
  • Kudos: 11
    • http://june.tripod.com
PHP Scope Oddness, Getting Around?
« on: 28 May 2005, 05:03 »
I learned a few days ago, that in order to use variables in PHP that were declared in the global scope, you need to redeclare (well, use the global keyword with them) them in a function in order to use them, else the function will use it's own version (wth?).

Is there a way to tell the interpreter to scope things normally\properly?

I get the feeling this was done to make things "easier" somehow for people to write code in PHP. That wouldn't make sense. Even QuickBASIC programmers had to learn about scope.

EDIT: Sorry if this has already been brought up. Took a quick glance at the asked questions and didn't see it.
« Last Edit: 28 May 2005, 05:09 by anphanax »