Re: [PHP] $GLOBALS example script on php.net

2011-03-07 Thread FeIn
I am unable to provide a better definition that user defined variables. User defined variables are variables that are declared by the user. User here means the creator (or maintainer of the script). So for: ?php $a = 'A'; $b = 'B'; $c = 'C'; function globals() { $globals = $GLOBALS;

Re: [PHP] $GLOBALS example script on php.net

2011-03-07 Thread Ashim Kapoor
?php $globalvar1=1; $globalvar2=2; function globals() { $globals = $GLOBALS; var_dump($GLOBALS); print_r(br /Before...); print_r($globals); foreach (array( 'GLOBALS', '_ENV', 'HTTP_ENV_VARS', '_POST', 'HTTP_POST_VARS', '_GET',

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread Ashim Kapoor
It doesn't though, it creates a copy of the $_GLOBALS super global array, removes entries that will have been set by the system (i.e. it leaves user-defined variables) and then returns the ones that are left, so in that, the user note is perfectly correct. What has me puzzled is how unsetting

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread FeIn
Unsetting doesn't leave user defined variables. Unsetting simply destroys variables (or removes elements from an array, etc). There is nothing magic or hidden in that script. I think the note meant exactly what it said: after creating a local copy of the $GLOBALS array and removing super globals

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread Ashim Kapoor
Unsetting doesn't leave user defined variables. Unsetting simply destroys variables (or removes elements from an array, etc). There is nothing magic or hidden in that script. I think the note meant exactly what it said: after creating a local copy of the $GLOBALS array and removing super

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Richard Quadling
On 5 March 2011 05:44, Ashim Kapoor ashimkap...@gmail.com wrote: Dear all, I was reading this page http://php.net/manual/en/reserved.variables.globals.php and  I found the following script there : Here's a function which returns an array of all user defined global variables: ?php

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Ashim Kapoor
I'll remove it. How does one remove user notes from php.net ? Thank you, Ashim

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread David Hutto
On Sat, Mar 5, 2011 at 5:10 AM, Ashim Kapoor ashimkap...@gmail.com wrote: I'll remove it.  How does one remove user notes from  php.net ? I'd guest they had been granted access to the php.net page editor, but I may be wrong. Not that that site hasn't been scraped by other sites and added to

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Daniel Brown
On Sat, Mar 5, 2011 at 05:42, David Hutto smokefl...@gmail.com wrote: I'd guest they had been granted access to the php.net page editor, but I may be wrong. Not that that site hasn't been scraped by other sites and added to their content, or been catalogued by google cache or alexis, etc.

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Ashim Kapoor
Dear Ashley, I do follow the part when it creates a local copy of $GLOBALS. When it unsets them, is there a subtlety of unset that it ONLY unsets system defined entries? Could you please explain this ? Thank you, Ashim

[PHP] $GLOBALS example script on php.net

2011-03-04 Thread Ashim Kapoor
Dear all, I was reading this page http://php.net/manual/en/reserved.variables.globals.php and I found the following script there : Here's a function which returns an array of all user defined global variables: ?php function globals() { $globals = $GLOBALS; foreach (array(

[PHP] Globals or Super Global Variables To Be Reused from For Loops

2008-11-06 Thread Alice Wei
Hi, I have a snippet of code as shown in the following: $message2=47406|Detroit; $stringChunk2= explode(|, $message2); if ($message2!=) { $count_chunk2= count($stringChunk2); $count_chunk_2= $count_chunk2-1; } for ($j=0; $j$count_chunk2; $j++) { $string3=

Re: [PHP] Globals or Super Global Variables To Be Reused from For Loops

2008-11-06 Thread Bastien Koert
[snip] [/snip] Alice, The big problem here is that you are resetting the $string3 variable in the loop for ($j=0; $j$count_chunk2; $j++) { $string3= $stringChunk2[$j];// -- resetting the value if ($j $count_chunk_2) { $string2= OR ;

RE: [PHP] Globals or Super Global Variables To Be Reused from For Loops

2008-11-06 Thread Alice Wei
. Alice Date: Thu, 6 Nov 2008 10:22:44 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-general@lists.php.net Subject: Re: [PHP] Globals or Super Global Variables To Be Reused from For Loops [snip] [/snip] Alice, The big problem here is that you are resetting the $string3

Re: [PHP] Globals or Super Global Variables To Be Reused from For Loops

2008-11-06 Thread Jim Lucas
curly brace? Thanks again for your help. Alice Date: Thu, 6 Nov 2008 10:22:44 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-general@lists.php.net Subject: Re: [PHP] Globals or Super Global Variables To Be Reused from For Loops [snip] [/snip] Alice, The big

RE: [PHP] Globals or Super Global Variables To Be Reused from For Loops

2008-11-06 Thread Alice Wei
Hi, Thanks for your tip, and I am surprised that this could be done so easily. Alice Date: Thu, 6 Nov 2008 08:11:48 -0800 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] Globals or Super Global Variables To Be Reused

[PHP] globals, simpletest and php from command line

2006-08-30 Thread blackwater dev
I have a php app that runs on php4. I am writing some unit tests now using SimpleTest but some of the libraries that I have to pull in for testing are failing. For example, my db library sets some params: $dname=mydatabase; $usr=me; ..etc I then have some mysql functions that connect using

Re: [PHP] $GLOBALS, any probolems?

2005-02-10 Thread Richard Lynch
Bruno B B Magalhães wrote: is there any problems using $GLOBALS superglobal to carry all my global classes instances? For example: $GLOBALS['myclass'] = new myclass(); This is exactly the same as: $myclass = new myclass(); as far as I've ever been able to tell, except that $GLOBALS is a

[PHP] $GLOBALS, any probolems?

2005-02-09 Thread Bruno B B Magalhães
Hi guys, is there any problems using $GLOBALS superglobal to carry all my global classes instances? For example: $GLOBALS['myclass'] = new myclass(); Regards, Bruno B B Magalhaes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] globals

2004-03-31 Thread Daniel Bahena
is it too bad to have the globals = on in /etc/php.ini ? Best wishes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] globals

2004-03-31 Thread Robert Cummings
On Tue, 2004-03-30 at 20:31, Daniel Bahena wrote: is it too bad to have the globals = on in /etc/php.ini ? It is strongly advised to have this set to off for security and maintainability reasons. Cheers, Rob. -- .. | InterJinn

[PHP] Globals Variable question

2004-03-03 Thread Terence
Hi All, Can someone tell me which is better, or if there's a reason I should use one and not the other (since both seem to work), and if this is the correct way to access script variables inside functions (and classes): Example 1 $GLOBALS['db_name']=website; function QueryDB() { echo

[PHP] Globals problem - $_REQUEST good solution?

2004-01-12 Thread Ryan A
Hi, I am getting some variable from another program an the main problem is its coming mixed... eg: some get and some post So far I have coded this with register globals on because I didnt know which way it was coming.. now i want to do it with globals off... After going through the manual trying

Re: [PHP] Globals problem - $_REQUEST good solution?

2004-01-12 Thread CPT John W. Holmes
From: Ryan A [EMAIL PROTECTED] After going through the manual trying to find an answer I came accross $_REQUEST, is this a good solution? because I have never used this before or is this as bad as having globals on? The only simularity it has to register_globals ON is that you don't know

Re: [PHP] Globals problem - $_REQUEST good solution?

2004-01-12 Thread Ryan A
Cool. Thanks John. -Ryan The only simularity it has to register_globals ON is that you don't know what method provided the value. It could be POST, GET, or COOKIE. But... if you're validating the data properly anyhow, it really shouldn't matter where it's coming from. I use $_REQUEST

[PHP] globals?

2004-01-06 Thread Bryan Koschmann - GKT
Hi, I was just curious, how much longer are globals going to be supported? I had heard awhile back that they wouldn't be around for too long. Thanks, Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] $GLOBALS containing itself!!!

2003-12-15 Thread Gerard Samuel
Just curious about something I came across. I was looking at the $GLOBAL array, to see what my script was leaving behind. $GLOBALS contains a reference to itself. Even though its a reference, whats the sense with that?? Once its global, why should it have to call on itself? Im currently running

Re: [PHP] $GLOBALS containing itself!!!

2003-12-15 Thread Robert Cummings
On Mon, 2003-12-15 at 04:23, Gerard Samuel wrote: Just curious about something I came across. I was looking at the $GLOBAL array, to see what my script was leaving behind. $GLOBALS contains a reference to itself. Even though its a reference, whats the sense with that?? Once its global, why

RE: [PHP] $GLOBALS containing itself!!!

2003-12-15 Thread Wouter van Vliet
On maandag 15 december 2003 10:24 Gerard Samuel told the butterflies: Just curious about something I came across. I was looking at the $GLOBAL array, to see what my script was leaving behind. $GLOBALS contains a reference to itself. Even though its a reference, whats the sense with that??

[PHP] Globals set to off - Sessions

2003-10-27 Thread Steve Jackson
I am not sure what I have to do in order to control sessions in PHP 4.33 when globals are set to off. I used to use the following function to check if the user was of admin status; function check_admin_user() // see if somebody is logged in as admin and notify them if not { global $admin_user;

[PHP] Globals on/off , PHP.ini and .htaccess - Best solution?

2003-10-24 Thread Ryan A
Hi, we have a site that is catering to webhosts and programmers, as you can understand these people know computers and programs :-) They are fooling around with the default settings of their accounts and giving us funny results and basically being a PITA, asking them nicely to quit... we are sure

Re: [PHP] Globals on/off , PHP.ini and .htaccess - Best solution?

2003-10-24 Thread Curt Zirzow
* Thus wrote Ryan A ([EMAIL PROTECTED]): They are fooling around with the default settings of their accounts and giving us funny results and basically being a PITA, asking them nicely to Put in their .htaccess something like: php_value engine off :) all sub directories too went off...so

Re: [PHP] Globals on/off , PHP.ini and .htaccess - Best solution?

2003-10-24 Thread Eugene Lee
On Fri, Oct 24, 2003 at 02:59:58PM +0200, Ryan A wrote: : : (we are on a shared host and so dont have access to our php.ini file) : we are planning to turn globals off via a .htaccess file...nearly all our : php files are in root (/www/) , but we are also running a third party : application 1

[PHP] globals on globals off (help

2003-09-16 Thread Frank Tudor
This is more for a linux group post but I know someone can provide enlightenment on this issue. I have the latest version of apache and php I have created my entire sie in a foxserv environment on windows but my production environment is on mandrake linux 9.1 The globals are set to off but i'll

Re: [PHP] globals on globals off (help

2003-09-16 Thread Brad Pauly
Frank Tudor wrote: This is more for a linux group post but I know someone can provide enlightenment on this issue. I have the latest version of apache and php I have created my entire sie in a foxserv environment on windows but my production environment is on mandrake linux 9.1 The globals are set

Re: [PHP] globals on globals off (help

2003-09-16 Thread Jason Sheets
You can enable them on a per directory bases with .htaccess, take a look at http://www.php.net/manual/en/configuration.php. I recommend using the .htaccess method rather than globally turning on register globals. Jason Frank Tudor wrote: This is more for a linux group post but I know someone

RE: [PHP] Globals

2003-08-04 Thread Ford, Mike [LSS]
-Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: 01 August 2003 20:18 I'm curious if someone could explain to me why this is occuring: function blah() { //global $GLOBALS; echo 'Globals: pre'; print_r( $GLOBALS ); echo '/pre'; } As it is

[PHP] Globals

2003-08-01 Thread Chris Boget
I'm curious if someone could explain to me why this is occuring: function blah() { //global $GLOBALS; echo 'Globals: pre'; print_r( $GLOBALS ); echo '/pre'; } As it is shown above, with the 'global $GLOBALS' line commented out, the print_r() works and shows all the currently defined variables

Re: [PHP] Globals

2003-08-01 Thread Jim Lucas
Message - From: Chris Boget [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Friday, August 01, 2003 12:03 PM Subject: [PHP] Globals I'm curious if someone could explain to me why this is occuring: function blah() { //global $GLOBALS; echo 'Globals: pre'; print_r( $GLOBALS ); echo

Re: [PHP] Globals

2003-08-01 Thread Chris Boget
I'm curious if someone could explain to me why this is occuring: function blah() { //global $GLOBALS; echo 'Globals: pre'; print_r( $GLOBALS ); echo '/pre'; } As it is shown above, with the 'global $GLOBALS' line commented out, the print_r() works and shows all the currently

RE: [PHP] Globals

2003-08-01 Thread Jay Blanchard
[snip] $GLOBALS [/snip] From http://us2.php.net/language.variables.scope The $GLOBALS array is an associative array with the name of the global variable being the key and the contents of that variable being the value of the array element. Notice how $GLOBALS exists in any scope, this is because

Re: [PHP] Globals

2003-08-01 Thread Jim Lucas
, but it seems odd to me to do this. A little redundant if you ask me. Jim Lucas - Original Message - From: Chris Boget [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Friday, August 01, 2003 12:17 PM Subject: Re: [PHP] Globals I'm curious if someone could explain to me why

Re: [PHP] Globals

2003-08-01 Thread Jim Lucas
just to let you know, the $GLOBALS[] superglobals was around long before php 4.1.0 Jim Lucas - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Chris Boget [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Friday, August 01, 2003 12:18 PM Subject: RE: [PHP] Globals

RE: [PHP] Globals

2003-08-01 Thread Jay Blanchard
[snip] just to let you know, the $GLOBALS[] superglobals was around long before php 4.1.0 // Superglobals are available in any scope and do // not require 'global'. Superglobals are available // as of PHP 4.1.0 [/snip] This is the quote in the online manual -- PHP General Mailing List

[PHP] Globals off and passing data

2003-02-08 Thread Paul
I'm working in a multitiered envoronment in development. I'd like to turn globals off, but I can't figure out how to pass data back and forth between machines. I'm sending data to a database machine using POST, and I can use the data once it gets there, but I can't seem to get anything back. At

Re: [PHP] Globals off and passing data

2003-02-08 Thread Jason Wong
On Sunday 09 February 2003 06:32, Paul wrote: I'm working in a multitiered envoronment in development. I'd like to turn globals off, but I can't figure out how to pass data back and forth between machines. I'm sending data to a database machine using POST, and I can use the data once it gets

Re: [PHP] Globals off and passing data

2003-02-08 Thread Paul
I'm opening a socket to the remote machine and using post to send the data. But please enlighten me, what is the usual method of accessing a remote database? Jason Wong wrote: On Sunday 09 February 2003 06:32, Paul wrote: I'm working in a multitiered envoronment in development. I'd like to

Re: [PHP] Globals off and passing data

2003-02-08 Thread Jason Wong
On Sunday 09 February 2003 07:59, Paul wrote: I'm opening a socket to the remote machine and using post to send the data. But please enlighten me, what is the usual method of accessing a remote database? One usually use stuff like mysql_connect() and friends to connect to databases. If you're

[PHP] Question about SSL/php globals

2003-01-27 Thread Wei Weng
Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port? Thanks! Wei -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Question about SSL/php globals

2003-01-27 Thread Philip Olson
On Mon, 27 Jan 2003, Wei Weng wrote: Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port? $_SERVER['HTTPS'] Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Question about SSL/php globals

2003-01-27 Thread Wei Weng
PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 12:19 PM Subject: Re: [PHP] Question about SSL/php globals On Mon, 27 Jan 2003, Wei Weng wrote: Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port? $_SERVER['HTTPS

[PHP] globals off in function

2003-01-14 Thread Michael Bevz
Hi, all!!! I've such trouble: ( register_globals = off ) in function i call to $smarty variable function showLoginForm(){ global $db, $smarty; // $smarty = new Smarty in main code $smarty-assign(message, $message); // and i receive this error message Fatal error: Call to a

Re: [PHP] globals off in function

2003-01-14 Thread Jason Wong
On Tuesday 14 January 2003 18:46, Michael Bevz wrote: I've such trouble: ( register_globals = off ) The register_globals setting in php.ini has ... in function i call to $smarty variable function showLoginForm(){ global $db, $smarty; // $smarty = new Smarty in main code ...

Re: [PHP] globals off in function

2003-01-14 Thread Chris Hayes
in function i call to $smarty variable function showLoginForm(){ global $db, $smarty; // $smarty = new Smarty in main code Fatal error: Call to a member function on a non-object in Are you sure $smarty = new Smarty is in the main code? Can it be in another function? Try setting

Re: [PHP] globals off in function

2003-01-14 Thread Michael Bevz
Chris Hayes [EMAIL PROTECTED] ïèøåò â ñîîáùåíèè:[EMAIL PROTECTED] in function i call to $smarty variable function showLoginForm(){ global $db, $smarty; // $smarty = new Smarty in main code Fatal error: Call to a member function on a non-object in Are you sure $smarty = new

[PHP] globals not working?

2002-10-04 Thread Paul Kaiser
I have an odd problem. I have a file called evt_to_web.php. This file contains some variable assignments and a few functions. I have used require_once evt_to_web.php; in another file, indextest.php. In indextest.php, I then call a function that is in evt_to_web.php. That function cannot seem

RE: [PHP] globals not working?

2002-10-04 Thread Jon Haworth
Hi Paul, function testGlobal() { global $evtredir_site; echo TestGlobal: '$evtredir_site'br\n; } When I do testGlobal(); I get: TestGloal: '' Change this function to: function testGlobal() { global $evtredir_site; echo TestGlobal: . $evtredir_site.

[PHP] $GLOBALS ???

2002-07-05 Thread Scott Fletcher
Let's say . --clip-- Page 1 - $data = Yes!; header(Location: test1.php); Page 2 - $data = $GLOBALS['data']; echo $data; --clip-- This one does not work! Does this ever work at all or do I need to do the header(Location: test1.php?data=Yes!); into the script? -- PHP General

RE: [PHP] $GLOBALS ???

2002-07-05 Thread Lazor, Ed
Correct you can add the data as a URL parameter. Or, you could set a cookie and use sessions. -Original Message- Let's say . --clip-- Page 1 - $data = Yes!; header(Location: test1.php); Page 2 - $data = $GLOBALS['data']; echo $data; --clip-- This one does not

Re: [PHP] $GLOBALS ???

2002-07-05 Thread Scott Fletcher
Oh boy! Alright! URL it is Ed Lazor [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Correct you can add the data as a URL parameter. Or, you could set a cookie and use sessions. -Original Message- Let's say . --clip-- Page 1 -

Re: [PHP] $GLOBALS ???

2002-07-05 Thread Scott Fletcher
What about PHPSESSID??? Can't use the $_COOKIE. Thanks, FletchSOD Ed Lazor [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Correct you can add the data as a URL parameter. Or, you could set a cookie and use sessions. -Original Message- Let's

RE: [PHP] $GLOBALS ???

2002-07-05 Thread Lazor, Ed
I don't understand. What do you mean? -Original Message- What about PHPSESSID??? Can't use the $_COOKIE. This message is intended for the sole use of the individual and entity to whom it is addressed, and

RE: [PHP] $GLOBALS ???

2002-07-05 Thread Lazor, Ed
Is this true? : Session variables are tracked whether or not a visitor's browser supports cookies. The session id is automatically appeneded to each url on the site if the user's browser doesn't support cookies. This represents one of the major differences between setting your own cookies and

Re: [PHP] Globals bug??

2002-07-01 Thread Marek Kilimajer
Are you using any opcode cache? Are you sure it is another process or might it be another thread. Marek [EMAIL PROTECTED] wrote: We are seeing a rare bug that seems to imply that there is a bug in PHP's global variables across httpd processes. To make a long story short, it appears that

Re: [PHP] Globals bug??

2002-07-01 Thread troy
When I said process I meant request. Sorry. Is it possible that the PHP globals are being used across requests (i.e., within the same process)? We noticed this when upgrading from a version of PHP (4.0.6?) prior to the new super-globals being added to PHP 4.1.2. The code in this case is so

[PHP] Globals bug??

2002-06-30 Thread troy
We are seeing a rare bug that seems to imply that there is a bug in PHP's global variables across httpd processes. To make a long story short, it appears that on rare occassions our script gets the value of a HTTP_GET_VARS variable from another user's process. Is this possible? BTW, it seems to

Re: [PHP] Globals bug??

2002-06-30 Thread Rasmus Lerdorf
I don't see how. But if what you are saying is actually happening, then it is a Linux kernel-level bug if memory is leaking from one process to another. No matter how badly we screwed up in PHP, the kernel prevents such a screwup from infecting a separate process. I'd suggest having a close

Re: [PHP] Accessing PHP globals from a module.

2002-05-22 Thread Eric Veldhuyzen
On Tue, May 21, 2002 at 08:03:36AM -0700, Rasmus Lerdorf wrote: Depends a bit on what sort of globals you are after. If you mean a global variable set by the user in the global symbol table you would do: pval **tmp; if(zend_hash_find(EG(symbol_table), foo, 3, (void **)tmp) == SUCCESS)

Re: [PHP] Accessing PHP globals from a module.

2002-05-22 Thread Rasmus Lerdorf
On Tue, May 21, 2002 at 08:03:36AM -0700, Rasmus Lerdorf wrote: Depends a bit on what sort of globals you are after. If you mean a global variable set by the user in the global symbol table you would do: pval **tmp; if(zend_hash_find(EG(symbol_table), foo, 3, (void **)tmp) ==

[PHP] Accessing PHP globals from a module.

2002-05-21 Thread Eric Veldhuyzen
Hi, I have just written a module for PHP (in C, linked with PHP statically). Now I need to access session variables and other globals from whithin my module. But I can't find how I should do this, I see documentation on how to call user functions, and how to create new global varables, but now

[PHP] Accessing PHP globals from a module.

2002-05-21 Thread Eric Veldhuyzen
Hi, I have just written a module for PHP (in C, linked with PHP statically). Now I need to access session variables and other globals from whithin my module. But I can't find how I should do this, I see documentation on how to call user functions, and how to create new global varables, but now

Re: [PHP] globals in functions

2002-04-15 Thread Erik Price
On Saturday, April 13, 2002, at 01:37 PM, Paul Roberts wrote: Is there a quick way to set all variables as global so that they are avalible to a function, i'm doing an eval inside, so i need all the submitted variables to be avalible, or do i have to decalre them individualy. If you

[PHP] globals in functions

2002-04-13 Thread Paul Roberts
Is there a quick way to set all variables as global so that they are avalible to a function, i'm doing an eval inside, so i need all the submitted variables to be avalible, or do i have to decalre them individualy. Paul Roberts [EMAIL PROTECTED] -- PHP General

RE: [PHP] globals in functions

2002-04-13 Thread Cal Evans
, April 13, 2002 12:37 PM To: [EMAIL PROTECTED] Subject: [PHP] globals in functions Is there a quick way to set all variables as global so that they are avalible to a function, i'm doing an eval inside, so i need all the submitted variables to be avalible, or do i have to decalre them individualy

[PHP] globals not working for me with 4.1.0

2002-01-08 Thread Matt Pieklik
Hello, I had a script that was workin for me with PHP 4.0.6. I upgraded to 4.1.0 because another app required it, and it broke the original script I was using. Under 4.0.6 I was able to do the following: global $PHP_AUTH_USER,$PHP_AUTH_PW; echo $GLOBALS[REMOTE_ADDR]; This would echo the correct

[PHP] $GLOBALS array

2001-12-23 Thread Philip MacIver
Does anyone know if it is possible to use the 'global $varName' function with the '$GLOBALS' array itself. I have been having some trouble with this. I have decieded to switch of register_globals in the php.ini file (seeing as it is now deprecated in version 4.1.0) I know that

RE: [PHP] $GLOBALS

2001-11-13 Thread PACKER, Steffan
PROTECTED] Subject: [PHP] $GLOBALS hi, i´m new in PHP. What does the expression: $ref=$GLOBALS[HTTP_GET_VARS][ref]; $id=$GLOBALS[HTTP_GET_VARS][id]; do? What is $GLOBALS? What are the parameters [HTTP_GET_VARS][ref]? thanks Peter -- GMX - Die Kommunikationsplattform im Internet. http

Re: [PHP] $GLOBALS

2001-11-13 Thread Emil Rasmussen
i´m new in PHP. What does the expression: $ref=$GLOBALS[HTTP_GET_VARS][ref]; $id=$GLOBALS[HTTP_GET_VARS][id]; do? It gives you the content of the querystring variable ref and id. eg. page.php?id=20ref=value What is $GLOBALS? $GLOBALS is an array wich contains all the varibles in the

[PHP] $GLOBALS

2001-11-13 Thread Peter Tilm
hi, i´m new in PHP. What does the expression: $ref=$GLOBALS[HTTP_GET_VARS][ref]; $id=$GLOBALS[HTTP_GET_VARS][id]; do? What is $GLOBALS? What are the parameters [HTTP_GET_VARS][ref]? thanks Peter -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- PHP General

RE: [PHP] Globals and HTTP_SESSION_VARS variables.

2001-09-26 Thread Johnson, Kirk
Is here anyway to make a variable like $var not the same than $HTTP_SESSION_VARS[var], when register_globals=1?. (where $var is in the script scope). I read in a changelog that this is relatively recent (make $var the same than $HTTP_SESSION_VARS[var]). I'm not sure what was changed.

[PHP] Globals and HTTP_SESSION_VARS variables.

2001-09-25 Thread Rodolfo Gonzalez Gonzalez
Hi, Is here anyway to make a variable like $var not the same than $HTTP_SESSION_VARS[var], when register_globals=1?. (where $var is in the script scope). I read in a changelog that this is relatively recent (make $var the same than $HTTP_SESSION_VARS[var]). Thank you. Regards, Rodolfo. --

RE: [PHP] PHP globals aren't really globals

2001-02-16 Thread php3
Addressed to: Maxim Maletsky [EMAIL PROTECTED] [EMAIL PROTECTED] Christian Dechery [mailto:[EMAIL PROTECTED]] ** Reply to note from Maxim Maletsky [EMAIL PROTECTED] Fri, 16 Feb 2001 12:18:27 +0900 I never used 50 of them, but I think there's such a thing as

RE: [PHP] PHP globals aren't really globals

2001-02-15 Thread Maxim Maletsky
-Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 14, 2001 11:25 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP globals aren't really globals I've been programming in C all my life, and now I just started developing in PHP and I'm really enjoying

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Thierry Coopman
At 11:24 AM -0300 2/14/01, Christian Dechery wrote: I've been programming in C all my life, and now I just started developing in PHP and I'm really enjoying it, it has all the missing improvements that C needed to be more user-likely. But one thin I can't get, how can PHP call a variabel global,

RE: [PHP] PHP globals aren't really globals

2001-02-14 Thread Boget, Chris
function u want to use it. THis is not nice, what about if u have a form with 50 fields and want a function to validate all of them, u have to pass them all to the function or build a little piece of code to make all the $GLOBALS local right? Is this really the idea of global vars? Yes.

RE: [PHP] PHP globals aren't really globals

2001-02-14 Thread Christian Dechery
function u want to use it. THis is not nice, what about if u have a form with 50 fields and want a function to validate all of them, u have to pass them all to the function or build a little piece of code to make all the $GLOBALS local right? Is this really the idea of global vars? Yes.

RE: [PHP] PHP globals aren't really globals

2001-02-14 Thread Boget, Chris
Yes. But with regards to form variables, all you need to do is make one variable global: $HTTP_POST_VARS it is an associative array that contains all the post variables from the form. Make it global and just loop through it. exactly, u need to loop to an array to get the globals u want.

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Rasmus Lerdorf
I've been programming in C all my life, and now I just started developing in PHP and I'm really enjoying it, it has all the missing improvements that C needed to be more user-likely. But one thin I can't get, how can PHP call a variabel global, if it isn't global. A global var, is a var

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread John Vanderbeck
Perhaps I'm missing something. In order to access the value of any variable defined outside the scope of the function, you have to declare it as "global". This is true in every single instance. If you do not, then you cannot access the value of that variable. While it's been a while

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Rog
Rasmus wrote: I swore I would not have the same problem in PHP and thus the requirement for people to be explicit about using global variables inside functions. Hopefully it also forces a little bit of structure and organization on people. Hear, hear and thank you Rasmus. It seems to me that

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread John Vanderbeck
Rasmus wrote: I swore I would not have the same problem in PHP and thus the requirement for people to be explicit about using global variables inside functions. Hopefully it also forces a little bit of structure and organization on people. Hear, hear and thank you Rasmus. It seems to

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Christian Dechery
The idea is to avoid really nasty scope-related bugs that are common in C code that uses lots of global variables. Years and years ago when I wrote the first version of PHP I was working for a telco writing software for a large telephone switch. The code was huge and extremely ugly. Global

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Rasmus Lerdorf
I believe you use globals $var to ACCESS a global variable, not to define. That's correct. To be perfectly correct here, what you are doing is creating a reference to the global variable. Think of it as an alias to the same variable as the global variable. global $foo; would be

Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Michael McGlothlin
It's somewhat annoying to have to tell the function which variables are global sometimes but overall it makes it easier to avoid stupid mistakes. It is a good push to make me less prone to making things global. Usually I just avoid using globals and then pack what I do use into appropiate