Declaring function inside php that returns value to function calling statement that can be transfer to another variable.
Return function are used to return some values to their function calling statement. So here is the complete step by step tutorial for How to Create function in php with return value.
How to Create function in php with return value.
Code for function-with-return.php file.
<!doctype html> <html> <head> <meta charset="utf-8"> <title>How to Create function in php with return value</title> </head> <body> <?php $ValueHolder = Test(); echo $ValueHolder; function Test() { $a = " Hello "; $b = " Friends "; return $a . $b ; } ?> </body> </html>
Screenshot :