note 114069 deleted from function.return by tularis

From: Date: Wed, 08 Jan 2014 18:37:39 +0000
Subject: note 114069 deleted from function.return by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198161@lists.php.net to get a copy of this message
Note Submitter: david1989mail at yahoo dot com ---- You could use this in Functions: <?php function function_name($number){ $result = $number*2; return $result; } //Direct: echo function_name(3); //Or with a variable: $var = function_name(4); echo $var; ?> This will return and show on the screen number 6 and 8. Using return is much better, because you get the function as a variable, and you can easily use string functions. The way without return: <?php function function_name($number){ $result = $number*2; echo $result; } function_name(3); ?>

« previous php.notes (#198161) next »