|
Posted by Oliver Saunders on 11/26/05 01:57
no no no.
$str{} is deprecated
$str[] was deprecated but is now undeprecated
in fact $str[] will have more power than ever before:
<quote from="minutes php developers meeting"
src="http://www.php.net/~derick/meeting-notes.html#cleanup-for-vs">
1.
We will undeprecate [] for accessing characters in strings.
2.
{} will be deprecated in PHP 5.1.0 with an E_STRICT and removed
in PHP 6.
3.
For both strings and arrays, the [] operator will support
substr()/array_slice() functionality:
* [2,3] is elements (or characters) 2, 3, 4
* [2,] is elements (or characters) 2 to the end
* [,2] is elements (or characters) 0, 1, 2
* [,-2] is from the start until the last two elements in
the array/string
* [-3,2] this is the same as substr and array_slice()
* [,] doesn't work on the left side of an equation.
With these rules, the behaviour for strings will be:
* $str = "foo"; $str[] = "d"; we modify to make a
concatenation.
* $str = "fo"; $str[] = "od"; will concatenate to "food"
* $str = ""; $str[] = "d"; should become the string "d",
this should become an e_strict in 5.1.1. We need to check how common
this is first.
</quote>
Navigation:
[Reply to this message]
|