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

Richard S. Crawford vox-tech@lists.lugod.org
Thu, 6 Jun 2002 09:34:48 -0700


Pete,

The closest thing I can think of is checking to see if the variable is set...

if (!isset($myUnsetVariable)) print "This variable isn't set, you bastard!";

I haven't played with PHP since before 4.2, so I'm not sure if new levels of functionality have been added or not, but to my knowledge there is no method in PHP of pre-declaring variables or a PHP equivalent of "use strict".

There oughtta be, though.

There are a couple of PHP lists out there run by the php.net site.  If you can wade through the tons of "How do I disable my browser's back button with PHP" or "How can I change the content of a page without having to reload it" questions, then it can sometimes even be a useful resource.  Sometimes.


On Thu, Jun 06, 2002 at 09:22:25AM -0700, 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

-- 
Slainte,
Richard S. Crawford

mailto:rscrawford@mossroot.com		http://www.mossroot.com
AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
MSN:  underpope@hotmail.com

"It is only with the heart that we see rightly; what is essential is
invisible to the eye."  --Antoine de Saint Exupery

vi vi vi - the editor of the beast