Jump to content

object method returns by reference


HardCoreMore

Recommended Posts

Hi all,

 

Why when i set my method to returns by reference its giving me a notice that only variables should return by reference while where is not set to return by reference it don't.

 

Fro example:

 

interface i
{
function &m();
}

class a implements i 
{
public function &m()
{
	return $v;
}
}


$v = new a();
$v->m();

 

So i just return empty $v. Is this a good practice or should i just ignore the notice

Link to comment
https://forums.phpfreaks.com/topic/212980-object-method-returns-by-reference/
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.