Local variables
| From: | Faisal Nasim | Date: | Mon, 15 Nov 1999 14:55:54 +0000 |
| Subject: | Local variables | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6242@lists.php.net to get a copy of this message | ||
Greetings,
I would like to know if PHP4 supports local variables yet or not?
unset() is not a proper solution when using many variables
under different scopes.
I couldn't find local() or some equivalent function in the PHP docs.
An example to evaluate what I mean:
$str = "whizkid";
{
$str = "faisal";
print $str;
}
print $str;
Would print "faisal" twice. But I declare it under the first scope, it
should remain private or perhaps some keyword to make it private
to the specific code block which I declare it in!
The above code should print:
whizkidfaisal
once $str inside the code block is declared to be local for that
particular scope.
Thank you.
--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
FAX: (815) 846-2877 AOL IM: Whiz Swift