1

For example, echo and print output similarly but print returns 1. My book says this is useful for expressions.

I'm what scenarios should I expect to return values in my expressions? What use is it?

Boni
  • 127
  • 1
  • 4
  • Values are returned by using the optional return statement. Any type may be returned, including arrays and objects. This causes the function to end its execution immediately and pass control back to the line from which it was called.If the return is omitted the value NULL will be returned. – Mueyiwa Moses Ikomi May 20 '16 at 16:33
  • Can you clarify what you mean by "useful for expressions?" Don't go looking at `echo` or `print` for examples of how things should be done; they aren't even functions, but language constructs. – miken32 May 20 '16 at 19:58

1 Answers1

-1

for example : if you are dealing with post method and something went wrong you can use print_r($_POST); to see if the values are stored correctly.. hope that will help

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Mohamed Wannous
  • 181
  • 1
  • 2
  • 11