Jump to content

OOP return this question


razorsese

Recommended Posts

I have the following code:

 

 

My question is how i can return both the y and the z in magic function.( works with y alone)

 

class X{
  private y;
  private z;


   public function __construct($y,$z) {
    $this->y = $y;
    $this->z = $z;

   }
  public function magic()
  {
    return $this->{ $this->y }(); //need to return both  Y & Z
  }
}

Link to comment
https://forums.phpfreaks.com/topic/273335-oop-return-this-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.