diff --git a/language/types.xml b/language/types.xml index 263cd222b7..8b940384e8 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -1090,7 +1090,8 @@ echo "I'd like to have another {${ strrev('reeb') }}, hips"; They may also be accessed using braces like $str{42} - for the same purpose. However, using square array-brackets is preferred. + for the same purpose. However, using square array-brackets is preferred + because the {braces} style is deprecated as of PHP 6. @@ -1114,7 +1115,7 @@ $last = $str[strlen($str)-1]; $str = 'Look at the sea'; $str[strlen($str)-1] = 'e'; -// Alternative method using {} +// Alternative method using {} is deprecated as of PHP 6 $third = $str{2}; ?> @@ -2446,41 +2447,22 @@ examples: undefined. + Also, because PHP supports indexing into strings via offsets using + the same syntax as array indexing, the following example holds true + for all PHP versions: ]]> - Since PHP (for historical reasons) supports indexing into strings - via offsets using the same syntax as array indexing, the example - above leads to a problem: should $a become an array with its first - element being "f", or should "f" become the first character of the - string $a? - - - The current versions of PHP interpret the second assignment as - a string offset identification, so $a becomes "f", the result - of this automatic conversion however should be considered - undefined. PHP 4 introduced the new curly bracket syntax to access - characters in string, use this syntax instead of the one presented - above: - - - -]]> - - See the section titled String access by character for more information.