Re: Array Symbol Suggestion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sono-io@xxxxxxxxxxxxx wrote:
I'd like to make a suggestion for a change, or possibly an addition, to the PHP language.

I'm learning PHP and have been very excited with what it can do in relation to HTML.  But when I got to the part about arrays, I was disappointed to see that they are designated with a $ the same as other variables.  I was learning Perl before I switched, and it uses the @ sign to designate an array.  That makes it a lot simpler to see at a glance what is an array and what isn't - at least for beginners like me.

Has there been any talk of adopting the @ sign for arrays in PHP?  Or is that symbol used for something else that I haven't read about yet?

What is the proper channel for making suggestions like this?

Thanks,
Marc


Hi Marc,
I'm a PHP n00b as well and had similar thoughts regarding this..

just imagine two variables called the same thing.. a string and array.. and accidentally resetting one..

$oops = "something";

however, from my experience, there is often this kind of problem in
any language, and that is where naming conventions come in very handy.

I don't know if the PHP community has any standard convention.. but I
would suggest something like:

$a_foo  (for arrays)
$f_foo  (imploding into form variables)
$s_foo  (string variables)
$db_foo  (variables coming from databases perhaps)
etc..

This way, you'd never be confused of the origin of the variable.

Donovan



--
D Brooke

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux