Jump to content

droberts

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

droberts's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You are correct. I accidentally recreated the object and the new object obviously didn't have the property. Thanks
  2. Sorry for the confusion, I'm not in front of my php code and I mis-typed: $controller = 'testklass'; $k2 = new $controller(); call_user_func_array(array($k2 , 'hello'),null); print_r($k2); // Object ( ) $controller is the variable, not $name, and this code indeed does run, but the instance variable is not being set from the method call
  3. I have a method of a class which should assign an instance variable to that object: class testklass { public function hello() { $this->amihere = 'assigned in class'; } } This correctly assigns the amihere variable: $k1 = new testklass(); $k1->hello(); print_r($k1); // Object ( [amihere] => assigned in class ) This does not: $name = 'testklass'; $k2 = new $controller(); call_user_func_array(array($k2 , 'hello'),null); print_r($k2); // Object ( ) Is there a way around this? Thanks in advance!
×
×
  • 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.