Jump to content

__call magic method


Destramic

Recommended Posts

hey guys i have a __call method in my class...the probelm im having is how to get the arguments into this line

 

return $this->_db->$method($arguments);

 

if arguments where "test1" and "test2"

 

i want the call to do

 

return $this->_db->$method("test1", "test2");

 

the code below will put all arguments into one if anyone can help me on how i can seperate please

 

	public function __call($method, $arguments)
{
	if (method_exists($this->_db, $method))
	{	
		$arguments = implode(', ', $arguments);

		return $this->_db->$method($arguments);
	}
}

Link to comment
https://forums.phpfreaks.com/topic/248411-__call-magic-method/
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.