mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
2bf568e646
commit
bea96b6ea9
1 changed files with 8 additions and 3 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue