note 31320 modified in function.preg-split by alindeman
| From: | alindeman@php.net | Date: | Thu, 17 Apr 2003 11:30:48 +0000 |
| Subject: | note 31320 modified in function.preg-split by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46729@lists.php.net to get a copy of this message | ||
String datatype is already an array of characters:
$str = "blablabla";
$chr = $str[0];
echo $chr;
above piece of code will produce: 'b',
but documentation says that:
"Characters within strings may be accessed by specifying the zero-based offset of the desired
character after the string in curly braces...
...For backwards compatibility, you can still use array-braces for the same purpose. However, this
syntax is deprecated as of PHP 4. "
so using '[]' instead of '{}' is better.
--was--
String datatype is already an array of characters:
$str = "blablabla";
$chr = $str[0];
echo $chr;
above piece of code will produce: 'b',
but documentation says that:
"Characters within strings may be accessed by specifying the zero-based offset of the desired
character after the string in curly braces...
...For backwards compatibility, you can still use array-braces for the same purpose. However, this
syntax is deprecated as of PHP 4. "
so using '{}' instead of '[]' is better.
http://www.php.net/manual/en/function.preg-split.php