PHP Return Statement

What is Return statement?

Explanation

Return statement is used to end the execution of a function, eval() function or a script file. If called from a global scope it ends the execution of the script file.

Syntax:


return (Value);

Return statement can return values or else the value returned is null

Example :


<?php
function test1()
{
return;
}
print gettype(test1()) . "n";
?>
Result :

NULL

In the above example the value returned by "Return" statement is NULL

PHP Topics


Ask Questions

Ask Question