Re: [PHP-DEV] global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;

2001-07-02 Thread Zeev Suraski

(a) I agree that the names are long
(b) Remember that you can change the name by simply assigning it around 
(e.g., $GET_A = $HTTP_GET_VARS)
(c) I think that $GET_A is ugly :)  I'd go for something along the lines of 
$__GET
(d) Having these variables available on every function means that it's 
going to slow things down, so it's a no-no.  What we can do is do something 
along the lines of $GLOBALS - where it is available in every function that 
*uses* it.  The drawback here is that it means it will not be available via 
indirect reference (i.e., $foo = __GET, $$foo[bar]).  I don't think 
it's a serious drawback though.

Zeev

At 15:07 2/7/2001, Derick Rethans wrote:
Hello list,

sometimes I use PHP too, and today I noticed the things I described here.
Per coincidence, Jani, who is working on the new bugsystem, had the same
thoughts about this. I'll describe the problem now:

All the arrays which hold the vars are not in de global name space, you
you will always need to use the global keyword, or something like
$GLOBALS[HTTP_SESSION_VARS][username]; As you all can see, that's way
to long and cumbersome to type. Just see this example:

global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
global $HTTP_COOKIE_VARS;

if( empty($HTTP_GET_VARS['PHPSESSID'])  
 empty($HTTP_POST_VARS['PHPSESSID']) 
 empty($HTTP_COOKIE_VARS['PHPSESSID']) 
 !empty($sessid)

I think this looks much better:
if ( empty ($GET_A['PHPSESSID']) 
  empty ($POST_A['PHPSESSID']) 
  empty ($COOKIE_A['PHPSESSID']) 
  !empty ($sessid))

I propose to change the names of the arrays and to make these arrays
available in all functions, this will both eliminate the use of the global
keyword, and will shorten the names significantly. This will speed op
coding of course. Our proposal is to use the now second word of the array,
postfixed by _A (array).

regards,

Jani Taskinen
Derick Rethans


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

--
Zeev Suraski [EMAIL PROTECTED]
CTO   co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development 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-DEV] global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;

2001-07-02 Thread Cynic

At 14:07 7/2/2001, Derick Rethans wrote the following:
-- 
Hello list,

sometimes I use PHP too, and today I noticed the things I described here.
Per coincidence, Jani, who is working on the new bugsystem, had the same
thoughts about this. I'll describe the problem now:

All the arrays which hold the vars are not in de global name space, you
you will always need to use the global keyword, or something like
$GLOBALS[HTTP_SESSION_VARS][username]; As you all can see, that's way
to long and cumbersome to type. Just see this example:

global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
global $HTTP_COOKIE_VARS;

if( empty($HTTP_GET_VARS['PHPSESSID'])  
empty($HTTP_POST_VARS['PHPSESSID']) 
empty($HTTP_COOKIE_VARS['PHPSESSID']) 
!empty($sessid)

I think this looks much better:
if ( empty ($GET_A['PHPSESSID']) 
 empty ($POST_A['PHPSESSID']) 
 empty ($COOKIE_A['PHPSESSID']) 
 !empty ($sessid))

encapsulation!

I propose to change the names of the arrays and to make these arrays
available in all functions, this will both eliminate the use of the global
keyword, and will shorten the names significantly. This will speed op
coding of course. Our proposal is to use the now second word of the array,
postfixed by _A (array).

It will also (IMNSHO) lessen the readability of the code. And slow down 
things pretty much -- all that copying all over the place. I don't like it. 
And $GET_A['var'] looks like a function pointer to some fetching function, 
$POST['var'] would post $var somewhere... Dunno what would $COOKIE_A do. :)

PHP is my primary language (99% of time  work done in it).

regards,

Jani Taskinen
Derick Rethans




[EMAIL PROTECTED]
-
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7 


-- 
PHP Development 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-DEV] global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;

2001-07-02 Thread derick

On Mon, 2 Jul 2001, Zeev Suraski wrote:

 (a) I agree that the names are long
 (b) Remember that you can change the name by simply assigning it around
 (e.g., $GET_A = $HTTP_GET_VARS)

I know this, but then you'll end up with:
$GET_A = $GLOBALS[HTTP_GET_VARS];
$POST_A = $GLOBALS[HTTP_POST_VARS];
...

and this is what I don't like in every function :)

 (c) I think that $GET_A is ugly :)  I'd go for something along the lines of
 $__GET

I agree with that, $GET_A was just a proposal.

 (d) Having these variables available on every function means that it's
 going to slow things down, so it's a no-no.  What we can do is do something
 along the lines of $GLOBALS - where it is available in every function that
 *uses* it.  The drawback here is that it means it will not be available via
 indirect reference (i.e., $foo = __GET, $$foo[bar]).  I don't think
 it's a serious drawback though.

I think this would be excellent. I don't see any reason why I would
even want to use $foo = __GET;

regards,
Derick Rethans

-
PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
 SRM: Site Resource Manager - www.vl-srm.net
-


-- 
PHP Development 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-DEV] global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;

2001-07-02 Thread Cynic

/me smells $@, $#, $$, $' and stuff. :|
I don't really mind PHP being a bit verbose.

At 15:10 7/2/2001, Zeev Suraski wrote the following:
-- 
(a) I agree that the names are long
(b) Remember that you can change the name by simply assigning it around (e.g., $GET_A 
= $HTTP_GET_VARS)
(c) I think that $GET_A is ugly :)  I'd go for something along the lines of $__GET
(d) Having these variables available on every function means that it's going to slow 
things down, so it's a no-no.  What we can do is do something along the lines of 
$GLOBALS - where it is available in every function that *uses* it.  The drawback here 
is that it means it will not be available via indirect reference (i.e., $foo = 
__GET, $$foo[bar]).  I don't think it's a serious drawback though.

Zeev

At 15:07 2/7/2001, Derick Rethans wrote:
Hello list,

sometimes I use PHP too, and today I noticed the things I described here.
Per coincidence, Jani, who is working on the new bugsystem, had the same
thoughts about this. I'll describe the problem now:

All the arrays which hold the vars are not in de global name space, you
you will always need to use the global keyword, or something like
$GLOBALS[HTTP_SESSION_VARS][username]; As you all can see, that's way
to long and cumbersome to type. Just see this example:

global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
global $HTTP_COOKIE_VARS;

if( empty($HTTP_GET_VARS['PHPSESSID'])  
empty($HTTP_POST_VARS['PHPSESSID']) 
empty($HTTP_COOKIE_VARS['PHPSESSID']) 
!empty($sessid)

I think this looks much better:
if ( empty ($GET_A['PHPSESSID']) 
 empty ($POST_A['PHPSESSID']) 
 empty ($COOKIE_A['PHPSESSID']) 
 !empty ($sessid))

I propose to change the names of the arrays and to make these arrays
available in all functions, this will both eliminate the use of the global
keyword, and will shorten the names significantly. This will speed op
coding of course. Our proposal is to use the now second word of the array,
postfixed by _A (array).

regards,

Jani Taskinen
Derick Rethans


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

--
Zeev Suraski [EMAIL PROTECTED]
CTO   co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development 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]
--end of quote-- 


[EMAIL PROTECTED]
-
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7 


-- 
PHP Development 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-DEV] global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;

2001-07-02 Thread derick

On Mon, 2 Jul 2001, Cynic wrote:

 /me smells $@, $#, $$, $' and stuff. :|
 I don't really mind PHP being a bit verbose.

There is nothing wrong with being verbose of course, but there is a limit
on this. Writing 50 lines of code, and using in there around 20 times
$HTTP_SESSION_VARS or something like that can't be what PHP is intended
for. And the $__GET does not look like $@, $#, $$ or :| to me.

regards,
Derick


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