Re: Array Symbol Suggestion

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

 



On 12 January 2011 20:23,  <sono-io@xxxxxxxxxxxxx> wrote:
> Thanks for all the responses to my suggestion. ÂI realize this would be a major change, so that's why I also mentioned it as an addition to the language.
>
> I'm sure it's just what you're used to, but still being new to all this, it just makes sense (to me anyway) to have different symbols for different variable types:
> $scalar
> @array
> #hash
>
> Since the @ sign is already reserved, maybe there's another symbol that would work better? ÂI don't know. ÂThese are just ideas that I came up with while reading and I thought I'd throw it out there to see what others thought.
>
> I like the idea of a naming convention, so that's what I'll do in my scripts. ÂI also appreciate the heads up on is_string(), is_array(), and var_dump().
>
> Thanks again,
> Marc

PHP recently introduced namespaces to PHP5. One of the issues at the
time was the namespace separator. Do to all the common symbols already
being used, it was necessary to re-use one and the context dictates
its intent.

So whilst "\n" is the newline character, in the namespace string below

namespace my\namespaces\are\here;

the \n is not a newline.

With that, there are no common symbols available.



The Hungarian Notation [1] was what I was taught all those years ago
when I learnt standard C programming. I've kept that with me through
to PHP. Some say it is redundant in PHP. I suppose this is true, but
it works for me and doesn't really get in the way.

One thing to remember though is that PHP is a loosely typed language.
Having a mechanism which would somehow enforce the type based upon a
symbol would certainly be a different way of working for PHP.

This is mentioned in the [2] and is suggested to be a poor way of
working due to the lack of symbols in general.


Regards,

Richard.

[1] http://en.wikipedia.org/wiki/Hungarian_notation
[2] http://en.wikipedia.org/wiki/Hungarian_notation#Relation_to_sigils
-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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