Posted by Bertman on 05/13/05 19:30
Hello,
I want to change a variable in a function.
First I set a variable '$var1' to 'NO'.
Then I call the function, within the function he have to set the variable to
'YES'
Then I say: echo $var1;
$var1 is still 'NO' :S
<?PHP
$var1 = 'NO';
setvar();
echo $var1;
function setvar() {
$var1 = 'YES';
}
?>
Can a function set a variable outsite the function ?
BTW, this is a little example script.
Bert
Navigation:
[Reply to this message]
|