note 114068 added to function.return

From: Date: Wed, 08 Jan 2014 16:26:55 +0000
Subject: note 114068 added to function.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-198157@lists.php.net to get a copy of this message
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); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.return.php Edit -- https://master.php.net/note/edit/114068 Del: integrated -- https://master.php.net/note/delete/114068/integrated Del: useless -- https://master.php.net/note/delete/114068/useless Del: bad code -- https://master.php.net/note/delete/114068/bad+code Del: spam -- https://master.php.net/note/delete/114068/spam Del: non-english -- https://master.php.net/note/delete/114068/non-english Del: in docs -- https://master.php.net/note/delete/114068/in+docs Del: other reasons-- https://master.php.net/note/delete/114068 Reject -- https://master.php.net/note/reject/114068 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198157) next »