ali Tue Nov 25 17:07:26 2003 EDT
Modified files: /phpdoc/en/language types.xml Log: clarification: curly braces can be used to modify strings, too Index: phpdoc/en/language/types.xml diff -u phpdoc/en/language/types.xml:1.127 phpdoc/en/language/types.xml:1.128 --- phpdoc/en/language/types.xml:1.127 Tue Sep 30 04:40:06 2003 +++ phpdoc/en/language/types.xml Tue Nov 25 17:07:25 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.127 $ --> +<!-- $Revision: 1.128 $ --> <chapter id="language.types"> <title>Types</title> @@ -1029,9 +1029,9 @@ </sect3> <sect3 id="language.types.string.substr"> - <title>String access by character</title> + <title>String access and modification by character</title> <para> - 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. </para> @@ -1058,6 +1058,11 @@ // 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'; + ?> ]]> </programlisting>