[vox-tech] php question - strict variable declarations?

David Margolis vox-tech@lists.lugod.org
Thu, 6 Jun 2002 10:59:15 -0700 (PDT)


Peter,

Check this out:
http://www.php.net/manual/en/function.error-reporting.php

You can call this function, error_reporting(args); at the top of your page
with any of the various described constants as arguments.
By tweaking the level of error reporting manually, you may be able to
acheive the desired effect.  If this is your server and your running your own implementation of php, you
might also be able to adjust php.ini to reflect some of this behavior as
well.

from php manual:
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings)
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

Dave Margolis


On Thu, 6 Jun 2002, Peter Jay Salzman wrote:

> php is a very forgiving language -- a bit too forgiving.
>
> is there a directive to generate an error if uninitialized variables are
> used?
>
> i know there's a concept of declaration for arrays:
>
>    $array = array()
>
> is there a declaration for other data types?  if so, is there a way to
> have php force declarations of variables?
>
> i guess i'm looking for an equivalent to perl's "use strict" or
> fortran's "implicit none".
>
> pete
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech
>