you explain everything well, but my problem is that now, I don't remember syntaxes for statments, I mean when I watched this video I knew everything from it but now I can't remember Do, While or For loops...
Knowing Lua and VB made me already know about functions parametres and etc.. though your tutorials are very nicely done and I am actually understanding PHP more now. Thanks. :)
@Diifusal no, it isnt! If you write echo $total, the text will be echoed. If you return $total, you can use the value of $total, outside of the function.
@Diifusal It's not the same. You only use echo if you want it to appear on the website. For most of the functions you definitely don't want that. So you probably just want to continue working with the result "behind the scenes"
@JonnyJC93 Its just an example. Your not getting the point, he's teaching you how to return variables. You would never use this function, just an example.
Basically, when you use the return function it returns whatever variable that follows the return statement. That is, when he echoed add(12, 343), the value that got put into the echo function is the value of $total which was $a + $b.
He could have just as easily typed: $newVariable = add(12, 343); echo $newVariable;