note 120352 added to functions.returning-values
| From: | k-gun!!mail | Date: | Mon, 19 Dec 2016 22:50:55 +0000 |
| Subject: | note 120352 added to functions.returning-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-208669@lists.php.net to get a copy of this message | ||
With 7.1, these are possible yet;
<?php
function ret_void(): void {
// do something but no return any value
// if needs to break fn exec for any reason simply write return;
if (...) {
return; // break
// return null; // even this NO!
}
$db->doSomething();
// no need return call anymore
}
function ret_nullable() ?int {
if (...) {
return 123;
} else {
return null; // MUST!
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 176.33.168.121
----
Manual Page -- http://php.net/manual/en/functions.returning-values.php
Edit -- https://master.php.net/note/edit/120352
Del: integrated -- https://master.php.net/note/delete/120352/integrated
Del: useless -- https://master.php.net/note/delete/120352/useless
Del: bad code -- https://master.php.net/note/delete/120352/bad+code
Del: spam -- https://master.php.net/note/delete/120352/spam
Del: non-english -- https://master.php.net/note/delete/120352/non-english
Del: in docs -- https://master.php.net/note/delete/120352/in+docs
Del: other reasons-- https://master.php.net/note/delete/120352
Reject -- https://master.php.net/note/reject/120352
Search -- https://master.php.net/manage/user-notes.php