Re: Accessing string offsets

From: Date: Sun, 11 Nov 2001 18:36:25 +0000
Subject: Re: Accessing string offsets
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-70149@lists.php.net to get a copy of this message
On Sun, Nov 11, 2001 at 08:19:38PM +0200, Andi Gutmans wrote : > I think it actually makes sense to have a warning here. This mail was not very good designed [tm], can you take a look at the other one I wrote which covers warning suppression? > >Btw, is $string{$offset} documented anywhere? Derick already told > >me its not but then its in PHP since a long time. Is $string{$offset} > >really faster but not well-tested? I've already even seen it in a > >PEAR package (Console/Getopt.php from Andrei). > > It's not documented yet because it hasn't been implemented yet (the syntax > is supported but I want to improve it in Zend 2). Actually, it is documented (thanks to Hartmut who pointed this out) on http://www.php.net/manual/en/language.types.string.php : String access by character Characters within strings may be accessed by specifying the zero-based offset of the desired character after the string in curly braces. Note: For backwards compatibility, you can still use the array-braces. However, this syntax is deprecated as of PHP 4. - Markus

« previous php.dev (#70149) next »