Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Can you call $m->MyFunction(); like that if the function is static? Commented Dec 24, 2009 at 10:17
  • yes you can, but maybe you shouldn't since it obscures the fact, that the function is object-bound .. Commented Dec 24, 2009 at 10:24
  • Weird. I thought you can only call static functions by ClassName::FunctionName and not by instantiating. Anyway, I have this doubt -> If you declare the variable like in case A) and use it like echo $MyMember, it is not working for me. It shouldn't work right? I am unable to understand your comment - //local there. Commented Dec 24, 2009 at 10:28
  • as far as i know, when you use "echo $MyMember;", it refers to the "local scope" (here, the function) of the variable, and since we haven't defined any "$MyMember" inside the function, this line yields "nothing" ... Commented Dec 24, 2009 at 10:32
  • oh! Since you didn't mention any fatal error or something, i thought it will work :D. +1 for taking time to explain all the cases :) Commented Dec 24, 2009 at 10:34