Function that echo values, how to set them to variable?
I have a class and there is a method of this class its output is get out by echo. What I need is to assign the echo value to a variable without printing it out!
Is there any way to cache the output of this function into a variable? I don't want to change the coding of the function.
echo "Hello World";
Usually the above example will print Hello World. I want something like the follwoing:
$obj = new MyClass();
$v = $obj->result(); // I don't want Hello World to be printed here???
/* after some logic */
echo $v; Here I want Hello World to be printed!!!