View Full Version : displaying a value and calling a function

03-26-2007, 02:54 AM
i want to display a variable at the top of the page but i cannot run the code to get that variable until after because i am displaying a table at a certain place on the page using that code.

Basically to get that value i was thinking if i called the function it would allow me to then display the current value after all the code has been run
However this displays all the output from that function at the top
Is there a way of calling a function without displaying it's output but just using selected values from that function

Or is there another way i can do this
I'll be shocked if anyone understands what i jus tried to explain!


03-26-2007, 03:46 AM
My head hurts. Maybe you want output buffering? I can honestly say I have no idea what you mean.

03-26-2007, 05:09 AM
Use a class, call the function, set two variables:

$this->top_output = $top;
$this->bottom_outpupt = $bottom;

Then echo the top, then go down the page and echo the bottom. Or use sessions, or just use two variables and forget the function.

Either way you have to run the code first to get your value, then just store your bottom output in another variable to display later.