- Changed example to use square brackets

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@260842 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Felipe Pena 2008-06-06 11:21:10 +00:00
parent 8d023a05ad
commit febcf0dd0f

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.16 $ -->
<!-- $Revision: 1.17 $ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.substr">
<refnamediv>
<refname>substr</refname>
@ -125,11 +125,11 @@ echo substr('abcdef', 0, 8); // abcdef
echo substr('abcdef', -1, 1); // f
// Accessing single characters in a string
// can also be achieved using "curly braces"
// can also be achieved using "square brackets"
$string = 'abcdef';
echo $string{0}; // a
echo $string{3}; // d
echo $string{strlen($string)-1}; // f
echo $string[0]; // a
echo $string[3]; // d
echo $string[strlen($string)-1]; // f
?>
]]>