While you are correct that invalid offset in a string will produce an
error message. This error message is E_NOTICE, given that our default
INI error reporting level won't display those it's arguable that very
few people will see them and consequently do something about it.
> echo $a{strlen($a)
echo $a{strlen($a)-1}; ? is that really that bad.
I do worry that at present
$a = "a string";
$p = 0
while( $p < strlen($p) )
.. do stuff that could do $p-- or $p++
echo $a{$p};
}
at present that would produce a nice error if you went < 0.. easy to
spot.. - if -ve was supported it could d
On Fri, 2004-10-29 at 19:31, Derick Rethans wrote:
> On Fri, 29 Oct 2004, Robert Cummings wrote:
>
> > On Fri, 2004-10-29 at 19:04, Derick Rethans wrote:
> >
> > > Yeah, [] is for arrays, {} for string indexes though I still think this
> > > should not be in, one can use substring for this. Someth
On Fri, 29 Oct 2004, Robert Cummings wrote:
> On Fri, 2004-10-29 at 19:04, Derick Rethans wrote:
>
> > Yeah, [] is for arrays, {} for string indexes though I still think this
> > should not be in, one can use substring for this. Something like a
> > "negative string index" is IMO too much magic.
>
On Fri, 2004-10-29 at 19:04, Derick Rethans wrote:
> On Fri, 29 Oct 2004, Sterling Hughes wrote:
>
> > why not add it with the {} operators then?
>
> Yeah, [] is for arrays, {} for string indexes though I still think this
> should not be in, one can use substring for this. Something like a
> "neg
On Fri, 29 Oct 2004, Sterling Hughes wrote:
> why not add it with the {} operators then?
Yeah, [] is for arrays, {} for string indexes though I still think this
should not be in, one can use substring for this. Something like a
"negative string index" is IMO too much magic.
Derick
--
Derick Re
t;[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 29, 2004 3:07 PM
Subject: [PHP-DEV] Negative string offset support
> I am wondering what are people's opinions on adding support for negative
> string offsets that could be used to access data from the end of a string
- Original Message -
From: "Ilia Alshanetsky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 29, 2004 3:07 PM
Subject: [PHP-DEV] Negative string offset support
> I am wondering what are people's opinions on adding support for negative
Sure, I have no operator preference.
Ilia
Sterling Hughes wrote:
why not add it with the {} operators then?
-sterling
On Fri, 29 Oct 2004 15:07:05 -0400, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote:
I am wondering what are people's opinions on adding support for negative
string offsets that could be
Right, I was about to say that too. If we only did it for the {} operator
it would encourage people to use that little-used operator thereby
removing a source of confusion and at the same time the BC issues are
minimal.
-Rasmus
On Fri, 29 Oct 2004, Sterling Hughes wrote:
> why not add it with t
Exactly what I thought when reading the original post :)
- Michael
> why not add it with the {} operators then?
>
> -sterling
>
>
> On Fri, 29 Oct 2004 15:07:05 -0400, Ilia Alshanetsky <[EMAIL PROTECTED]>
> wrote:
>> I am wondering what are people's opinions on adding support for negative
>> stri
why not add it with the {} operators then?
-sterling
On Fri, 29 Oct 2004 15:07:05 -0400, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote:
> I am wondering what are people's opinions on adding support for negative
> string offsets that could be used to access data from the end of a string.
>
> Ex. $a
I am wondering what are people's opinions on adding support for negative
string offsets that could be used to access data from the end of a string.
Ex. $a = "123"; echo $a[-1]; // would print 3
I don't think we should do this for arrays, since -1 and similar are
valid array keys, which means add
13 matches
Mail list logo