Function return values?

hey all, thought i drop in my question. i don’t understand when u return a value within function. whats the use of it? i mean how it is different from just functions?

Function returning echoes back to programming’s roots as an extension of mathematics - particularly calculus. To the computer a function is a calculation, and the return statement returns the result of that calculation. That return is then either assigned to a variable or used as part of an ongoing calculation.

Consider the function [fphp]pow[/fphp], which is used for exponents. Say we need the result of a + b squared. We’d do that with


echo $a + pow($b, 2);

Or put it into a variable.


$c = $a + pow($b, 2);

Functions follow the order of operations insofar as they follow paranthesis, but proceed other operations. So, parenthesis, functions, exponents/roots, multiplication/division, addition/subtraction.

For more on functions there’s the wiki article. They are a fundamental unit of all computer programming, not just PHP.

I’m not sure I understand the question; and thus the answer doesnt make any sense either?

I understood his question to be “What’s the point in returning values from functions?” - something an experienced programmer takes for granted.