Re: [PHP] Do you have some standard for defined the variable in program language?

[email protected] (tedd)
Newsgroups php.general
Message-ID <p06240804c874bf09d34d@[192.168.1.104]>
At 3:12 PM +0530 7/27/10, viraj wrote:
>$firstName is the most readable.. for variables.
>
>does anybody have negative thoughts on using the same naming format
>for method/function and for class names?
>
>i guess it's worth sharing! many thanks!
>
>~viraj


I like using $first_name.

I don't have any problems with using that convention for 
method/function/class names.

The only problem I have found (regardless of naming convention) is in 
using $_SESSION[]'s.

Sometimes:

$first_name = $_SESSION['first_name.'];

will cause problems. The solution is to use an index that's named 
different than the variable name, such as:

$first_name = $_SESSION['session_first_name.'];

Cheers,

tedd
-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.