0Pricing
PHP Academy · Lesson

Return Values

Retrieve results from functions in PHP.

1

Return Values

Welcome to the next lesson! In this lesson, you’ll learn about return values in PHP functions and how they allow you to pass the results of a function back to the calling code. Let’s dive in!

Return Values — illustration 1

2

What Are Return Values?

A return value is the result of a function’s execution. Instead of outputting data directly, a function can return it to be used elsewhere in the program.

Example: A function that calculates the area of a rectangle can return the result to the caller.

All lessons in this course

  1. What Are Functions?
  2. Built-in Functions
  3. User-Defined Functions
  4. Passing Arguments to Functions
  5. Return Values
← Back to PHP Academy