Log in / create account | Login with OpenID
DocForge
Programmer's Wiki

PHP/return

From DocForge

< PHP

return is a PHP construct which immediately ends function execution and optionally sets a value what will be returned to calling code. If no value is set null is returned.

Example:

function return_nothing() {
    return;
}
 
function return_true() {
    return true;
}
 
$value = return_nothing();  // $value is null
$value = return_true();  // $value is a boolean true

[edit] See Also