Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Functions

Functions are defined with a set of parameters, a body of code for processing, and a returned value, typed or not.

Methods are defined almost the same way, except for some more options and within the context of a class.

A function is said to be anonymous when it has no name. This is the case of the closures and the arrow functions.

<?php

    function foo($a, $b) {
        return $a - $b;
    }

?>

Documentation

See Also