Re: [PHP] Global Variables -- why not have them?

2001-07-08 Thread Inércia Sensorial

 You must learn it's way if you want to be effective. Also take a
 look at design features proposed for PHP5. Looks promising and more C++
like,
 so better compare it with the later one.

  I went to php.net and searched for some kind of docs on PHP5, but found
not a word. Where can I see this feature list?

--


  Julio Nobrega.

Yes, I am developing another 'Portal-System'
Have a look:
http://sourceforge.net/projects/toca



-- 
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]




Re: [PHP] Global Variables -- why not have them?

2001-07-08 Thread teo

Hi Inércia!
On Sun, 08 Jul 2001, Inércia Sensorial wrote:

  You must learn it's way if you want to be effective. Also take a
  look at design features proposed for PHP5. Looks promising and more C++
 like,
  so better compare it with the later one.
 
   I went to php.net and searched for some kind of docs on PHP5, but found
 not a word. Where can I see this feature list?
 
erm, Zeev wrote to the list some time ago and gave a link somewhere inside
www.zend.com site. As I don't have it handy I'll just point you to the site.

[n.b. is on zend.com cause the features regard the Zend engine]

-- teodor

-- 
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]




Re: [PHP] Global Variables -- why not have them?

2001-07-08 Thread Mark Charette

 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.

Global scope variable are inherently dangerous and cause more problems than
they're worth. I've been in this business well nigh 30 years now and have
had more problems with globals than I can shake a stick at. Passing
parameters ain't a bad thing, you know, even when what you're passing is a
variable declared in global scope (like variables set via post or get).
Global is inelegant by definition ...

I worked in Fortran 77 for 10 of those years; we were really careful with
common blocks and included them only where absolutely necessary. Passing
array blocks was in almost all cases a better thing and was not any
slower.

Mark C.


-- 
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]




Re: [PHP] Global Variables -- why not have them?

2001-07-08 Thread Brian White

At 20:13 8/07/2001 -0500, Mark Charette 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.

Brian
-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
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]




Re: [PHP] Global Variables -- why not have them?

2001-07-08 Thread mike cullerton

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]




Re: [PHP] Global Variables -- why not have them?

2001-07-07 Thread John Meyer

At 02:55 PM 7/7/01 -0400, Mitch Vincent wrote:
 I've been using PHP for several years now and one question has plagued
me the entire time. Why doesn't PHP have global variables? Before someone
says it, I do know PHP sort of does have global variables, but having to
specify GLOBAL in any function I want to see that variable in disqualifies
it from being a truly global variable IMHO..

 I suppose I'm more curious than anything else.. Thanks!

-Mitch


I don't know what the makers of PHP had in mind, but from my experience, 
having truly global variables is a very bad idea.  In fact, you should be 
trying to limit your need of global variables, so that your program can 
count on the integrity of the variables.


John Meyer
[EMAIL PROTECTED]
Programmer


If we didn't have Microsoft, we'd have to blame ourselves for all of our 
programs crashing


-- 
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]