note 59088 deleted from language.variables by cmb
| From: | cmb@php.net | Date: | Fri, 19 Apr 2019 15:13:29 +0000 |
| Subject: | note 59088 deleted from language.variables by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210625@lists.php.net to get a copy of this message | ||
Note Submitter: Mike at ImmortalSoFar dot com
----
References and "return" can be flakey:
<?php
// This only returns a copy, despite the dereferencing in the function definition
function &GetLogin ()
{
return $_SESSION['Login'];
}
// This gives a syntax error
function &GetLogin ()
{
return &$_SESSION['Login'];
}
// This works
function &GetLogin ()
{
$ret = &$_SESSION['Login'];
return $ret;
}
?>