Jump to content

Adding function... but it is returning a number


rockinaway

Recommended Posts

Right what I have is:

 

	function inform($msg)
	{
		$this->test = function($msg);


}

function render()
{
echo $this->test;
}

 

Now what I want to do is echo the result of function() when using render()... So I add function() to $test, but when I echo it in render() it returns 1.. what is the problem? How can I return the result of the function?

 

 

that code is weird man it makes no sence but did you mean this

class MyClass{
var $test;

function inform($msg)
{
	$this->test = $this->render($msg);
}

function render()
{
	echo $this->test;
}
}

 

that would have made sence

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.