I have two simple PHP functions:
<?
function print_txt($text) {
echo $text;
}
function store_data($name,$data){
define($name,$data);
}
?>
I want the second function to store data and use it later whenever I want but when I try to put the first function as a parameter it prints it directly.
E.g : store_data('my_data',print_text('hello world'));
when I reload the page the 'hello world' string appears
Is there any way to keep the data and control it ? Something like output buffering maybe ?
The method echo do not have any return value. Return the value in print_txt after you have print it:
return $text;
Or did not I get your question?