diff --git a/language/types.xml b/language/types.xml index 2b6a2394eb..95b7fdbc06 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -1029,9 +1029,9 @@ echo "I'd like to have another {${ strrev('reeb') }}, hips"; - String access by character + String access and modification by character - Characters within strings may be accessed by specifying the + Characters within strings may be accessed and modified by specifying the zero-based offset of the desired character after the string in curly braces. @@ -1058,6 +1058,11 @@ $third = $str{2}; // Get the last character of a string. $str = 'This is still a test.'; $last = $str{strlen($str)-1}; + +// Modify the last character of a string +$str = 'Look at the sea'; +$str{strlen($str)-1} = 'e'; + ?> ]]>