Variables not initialized. Is it possible to...

From: Date: Mon, 18 May 2009 15:38:37 +0000
Subject: Variables not initialized. Is it possible to...
Groups: php.general 
Request: Send a blank email to php-general+get-292731@lists.php.net to get a copy of this message
Is it possible to set a parameter in PHP 5 to ask the interpreter to raise an error every time I try to use a variable that wasn't initialized before ? For example, I've write this piece of code in Python: print(DonaldDuck) I get this error: Traceback (most recent call last): File "/Users/Cesco/Desktop/prova.py", line 3, in <module>
    print(DonaldDuck);
NameError: name 'DonaldDuck' is not defined Until now I've seen that when I write this PHP equivalent: echo($DonaldDuck); When I try to run it, the PHP writes a blank string, because the variable is not yet initialized and PHP assumes that its value is an empty string (I guess) I'd like to have the same behaviour of Python in PHP, do you think that it is possible?

« previous php.general (#292731) next »