Using return statement you can returned the values to calling function.
Using return statement in function is optional as we see in our previous chapters.
You can return any type of data including arrays and objects.
A function can not return multiple values.
When PHP see return in function, it cause ends of execution of function immediately and pass control to the line from which it was called.
$c = $a + $b;
echo "Addition of two values is " . add(2,6);
Addition of two values is 8
In above example function add() return value of $c from it is called.
Senior Java Developer
Java 11 | Microservices | Reactjs | SQL