Memory App

Function name

Function name is not case-sensitive and must not start with a number.

function name() {}
function Name() {}

// Fatal error: Cannot redeclare Name()


Note that since return is a language construct and not a function, the parentheses surrounding its arguments are not required. It is common to leave them out, also PHP has less work to do in this case.

function A() {
    return (1);
function B() {
    return 2; // faster
echo A(); // Output: 1
echo B(); // Output: 2


Even if you don't return a value, PHP will still cause your function to return NULL. The concept of "void" functions does not really apply to PHP.

function name() {}

echo name() === NULL; // Outputs: 1


Top Reference > Programming
0/0 (80)  
Not Logged