Jump to content

Salim

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Salim's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks a lot. This works fine. Although $clname::foo(); would have been much nicer (what a pity it doesn't work), call_user_func helps.
  2. Or if you want the values to be persistent and the same for all users, you would need a database or a file, where you have to load the information on each request.
  3. No it doesn't work. Anyway, what if the constructor expects parameters? In that case it wouldn't work when creating an object before.
  4. Hi, I have a strange problem, but I really need to figure out how this works. abstract class A { function A() { echo "constr. A"; } static abstract function foo(); } class B extends A { function B() { echo "constr. B"; } static function foo() { echo "B::foo"; } } class C extends A { function C() { echo "constr. C"; } static function foo() { echo "C::foo"; } } function getClName() { return C; } $clname = getClName(); // $obj = new $clname(); // this would work $clname::foo(); // this does not work! how can I make this work? I think you can see my problem. I want to call a static method of a class I don't know. It works perfectly when constructing an object and calling its non-static methods. But how can I call its static methods without creating an object from it? greetings, Salim
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.