RE: [PHP] Variable naming standards???

2002-08-13 Thread Jay Blanchard

[snip]
A philosophical question
Are there any standards to naming variables??
I was told that one should include a letter or combination of letters to
describe a variable
i.e.
$sfoo = 'string';  // string
$bfoo = true;  // bool
$nfoo = 10;  // interger
[/snip]

http://ootips.org/hungarian-notation.html

Hungarian notation was conceived so that variable types would be easily
identifiable in code. YMMV

Jay



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Variable naming standards???

2002-08-13 Thread Nicholas Mercier

My two cents,

I think if you are working on a personal product you use what works for 
you.  If working in a group find out or decide as a group what standards to 
use.  The hungarian standards are well designed, but I've seen others that 
work as well.

When posting data from a from to another script I've see F used... as in 
$f_username $f_userpass.
As well as many others.

The best advise I could give with my (VERY) limited experience, chose a 
constant method for yourself and stick to it.  That way it will become 
second nature to you.

Nick

At 09:52 AM 8/13/2002 -0400, Gerard Samuel wrote:
A philosophical question
Are there any standards to naming variables??
I was told that one should include a letter or combination of letters to 
describe a variable
i.e.
$sfoo = 'string';  // string
$bfoo = true;  // bool
$nfoo = 10;  // interger

etc

Thanks

--
Gerard Samuel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Variable naming standards???

2002-08-13 Thread Pushkar Pradhan

Samuel this is what you can use as a standard (at least for yourself):
http://www.cs.msstate.edu/~cs1314/global/guide

It describes how to name variables, functions, scripts etc. In short the
variable names must tell the programmer what it is being used for,
e.g. $countHits = 0; // initialize counter to count no. of hits on the
page
or use _ to separate words - $count_hits = 0;
On Tue, 13 Aug 2002, Nicholas Mercier wrote:

 My two cents,

 I think if you are working on a personal product you use what works for
 you.  If working in a group find out or decide as a group what standards to
 use.  The hungarian standards are well designed, but I've seen others that
 work as well.

 When posting data from a from to another script I've see F used... as in
 $f_username $f_userpass.
 As well as many others.

 The best advise I could give with my (VERY) limited experience, chose a
 constant method for yourself and stick to it.  That way it will become
 second nature to you.

 Nick

 At 09:52 AM 8/13/2002 -0400, Gerard Samuel wrote:
 A philosophical question
 Are there any standards to naming variables??
 I was told that one should include a letter or combination of letters to
 describe a variable
 i.e.
 $sfoo = 'string';  // string
 $bfoo = true;  // bool
 $nfoo = 10;  // interger
 
 etc
 
 Thanks
 
 --
 Gerard Samuel


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-Pushkar S. Pradhan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php