Crashsector
[H]ard|Gawd
- Joined
- Jul 10, 2001
- Messages
- 1,125
I'm back.
I have a function whose primary purpose is to set a few variables. These variables are to be used outside the function. I'm having problems making them do this.
I understand that variables in the script (outside the function) aren't available inside the function (this isn't a problem), but I can't seem to access the variables set inside the function from the rest of the script.
For example:
For whatever reason, nothing is returned. I would like the last line to return '2a'.
This is probably dirt easy, but you never know. Thanks!
I have a function whose primary purpose is to set a few variables. These variables are to be used outside the function. I'm having problems making them do this.
I understand that variables in the script (outside the function) aren't available inside the function (this isn't a problem), but I can't seem to access the variables set inside the function from the rest of the script.
For example:
PHP:
function testfunction( $x ) {
$y = $x."a";
}
testfunction( '2' );
echo $y;
For whatever reason, nothing is returned. I would like the last line to return '2a'.
This is probably dirt easy, but you never know. Thanks!