clarification: curly braces can be used to modify strings, too

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@144915 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
ali 2003-11-25 22:07:25 +00:00
parent 2bf568e646
commit bea96b6ea9

View file

@ -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 @@ echo "I'd like to have another {${ strrev('reeb') }}, hips";
</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 @@ $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';
?>
]]>
</programlisting>