on 7/8/01 7:57 PM, Brian White at [EMAIL PROTECTED] wrote:

>>> I dislike the GLOBAL statement in that many of the bugs that get me
>>> scratching my
>>> head are to do with when I have forgotten to use it.
>> 
>> Then you're probably using it way too often.
> 
> It is usually for "SCRIPT_NAME", or one of the CGI parameters.
> 
> The CGI parameters are arguable, but I pretty much consider SCRIPT_NAME to be
> a global constant.

php does have constants which are _always_ global.

define ("SCRIPT_NAME", $passed_in_script);

then you refer to it like

   my_function() {
     printf("script is %s",SCRIPT_NAME);
   }

notice there are no quotes or '$' or anything.

i've recently changed $DEBUG to DEBUG for things like

  define("DEBUG", 1);

  my_db_function() {
    $rid = $db->query($query);
    if (!DB::isError) {
      do_something_cool();
    } else {
      if (DEBUG) printf("<!-- bummer, query failed : %s
-->\n",$rid->getMessage())
  }

 -- mike cullerton



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to