Require variable definition

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,

sorry for the Newie question: is it possible to require variables in
PHP to be defined by the author? I'm used to this from C, and like this
"strict" behavior, as otherwise very easily typos in variable names can
lead to bugs...

Basically, I'm looking for the PHP equivalent of VBA's "Option


Re: Require variable definition

Alexander Fischer wrote:
Quoted text here. Click to load it

These will show up as warnings at run time.

AFAIK there is no way of making PHP flag them up as anything else (you
could write your own error handler to do this). IIRC phplint can do
offline checking of code - try google for a URL



Re: Require variable definition

C. wrote:
Quoted text here. Click to load it
Only if you have E_NOTICE on in your php.ini (or set in your custom
error reporting level). Editors like ZEND Studio also check that sort
of thing for you, if you use the Anaylse Code functionality.

Re: Require variable definition


william.clarke wrote:
Quoted text here. Click to load it

Site Timeline