On 18 November 2005 11:48, Derick Rethans wrote:

> On Fri, 18 Nov 2005, Andreas Korthaus wrote:
> 
> > Derick Rethans wrote:
> > 
> > > > That's the problem - also grep does not know if [] is used for
> > > > arrays or stings. That's the same for programmers, it's often
> > > > not easy to conclude from context - that's my point.
> > > 
> > > grep won't, but php -l will.
> > 
> > That's true. But what about "reducing complexity"?
> > 
> > Don't you think it's useful to allow a convention like {} for
> > strings and [] for arrays, so you can be sure what $str{1} means
> > without looking at any context?
> 
> No.

Why not?  If users demand it, why not allow them that facility?

I think the visual difference between [] for arrays and {} for string access is 
a superb feature of PHP.  (Personally, I'd like to see it extended to something 
like $s{2:5} or $s{2,3} for longer substrings, but I've proposed that before 
and been shot down so I won't mention it ;)

If {} for string access goes away, I won't be converting to [] becasue I think 
a visual difference is vital -- so all my $s{$x} will be turned into substr($s, 
$x, 1).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to