PHP return statement

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.

For example:

Output

In above example function add() return value of $c from it is called.

Ankit Wasankar

Senior Java Developer
Java 11 | Microservices | Reactjs | SQL

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.