scoping: can someone explain to me if this should/should not work?
| From: | Doug Farmer | Date: | Wed, 26 Sep 2001 22:26:21 +0000 |
| Subject: | scoping: can someone explain to me if this should/should not work? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-68929@lists.php.net to get a copy of this message | ||
The following code seems to work in general but everyone once in a while I'm
getting a segmentation fault. Can someone explain to me why this would be
intermittent and/or whether or not it should work?
function getDomain($serverName)
{
$result = $serverName;
// some processing to result occurs here
echo "here 3: $result<br>";
return $result;
}
function test()
{
global $SERVER_NAME;
echo "here 1<br>";
$domain = getDomain($SERVER_NAME);
echo "here 2<br>";
}
When I get a segv, I get the output:
here 1
here 3: <appropriate value here>
The "here 2" is not displayed. I thought that this would a return by copy
and not have an issue.
- doug