variable - function question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bytte
Forum Commoner
Posts: 75
Joined: Sun Nov 23, 2003 8:20 am
Location: Belgium

variable - function question

Post by bytte »

I have a function that ends with the echo of a number.
So if I call the function in my script, the visible result is a number.

I'm calling the function quite a lot and the output is everytime a different number.

No problem so far.

Now I need to do simple calculations with these outputted numbers.
How can I put them into a variable, so I can easily work with them?

Or how can I use the variable of the function in my script outside of the function?
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

$var = Function(); - if you do a return instead of an echo which is more proper anyways
Post Reply