rockinaway Posted October 6, 2007 Share Posted October 6, 2007 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? Link to comment https://forums.phpfreaks.com/topic/72097-adding-function-but-it-is-returning-a-number/ Share on other sites More sharing options...
emehrkay Posted October 6, 2007 Share Posted October 6, 2007 I am trying to understand what you are trying to do and how setting a property to an empty function relates to the render function - im lost. What exactly are you trying to do? Link to comment https://forums.phpfreaks.com/topic/72097-adding-function-but-it-is-returning-a-number/#findComment-363559 Share on other sites More sharing options...
KrisNz Posted October 7, 2007 Share Posted October 7, 2007 Err, if test is set in the inform function, why don't you try calling said function before trying to output the value it sets? Link to comment https://forums.phpfreaks.com/topic/72097-adding-function-but-it-is-returning-a-number/#findComment-363638 Share on other sites More sharing options...
RichardRotterdam Posted October 7, 2007 Share Posted October 7, 2007 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 Link to comment https://forums.phpfreaks.com/topic/72097-adding-function-but-it-is-returning-a-number/#findComment-363960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.