mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Clear up some more text.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@132429 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a37d310b92
commit
d298524aee
1 changed files with 22 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.118 $ -->
|
||||
<!-- $Revision: 1.119 $ -->
|
||||
<chapter id="language.types">
|
||||
<title>Types</title>
|
||||
|
||||
|
@ -1285,14 +1285,15 @@ echo $arr[12]; // 1
|
|||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
A <varname>key</varname> may be either an integer
|
||||
<type>string</type>. If a key is the standard representation of
|
||||
an <type>integer</type>, it will be interpreted as such (i.e.
|
||||
<literal>"8"</literal> will be interpreted as
|
||||
<literal>8</literal>, while <literal>"08"</literal> will be
|
||||
interpreted as <literal>"08"</literal>). There are no different
|
||||
indexed and associative array types in PHP; there is only one
|
||||
array type, which can both contain integer and string indices.
|
||||
A <varname>key</varname> may be either an
|
||||
<literal>integer</literal> or a <type>string</type>. If a key is
|
||||
the standard representation of an <type>integer</type>, it will
|
||||
be interpreted as such (i.e. <literal>"8"</literal> will be
|
||||
interpreted as <literal>8</literal>, while
|
||||
<literal>"08"</literal> will be interpreted as
|
||||
<literal>"08"</literal>). There are no different indexed and
|
||||
associative array types in PHP; there is only one array type,
|
||||
which can both contain integer and string indices.
|
||||
</para>
|
||||
<para>
|
||||
A value can be of any PHP type.
|
||||
|
@ -1311,14 +1312,14 @@ echo $arr["somearray"]["a"]; // 42
|
|||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
If you provide the brackets without specifying a key, then the
|
||||
maximum of the integer indices is taken, and the new key will be
|
||||
that maximum value + 1--unless that maximum value is negative
|
||||
(is it perfectly legal to have negative array indices). In this
|
||||
case, the new key will be <literal>0</literal>. If no integer
|
||||
indices exist yet, the key will be <literal>0</literal>
|
||||
(zero). If you specify a key that already has a value assigned
|
||||
to it, that value will be overwritten.
|
||||
If you do not specify a key for a given value, then the maximum
|
||||
of the integer indices is taken, and the new key will be that
|
||||
maximum value + 1--unless that maximum value is negative (is it
|
||||
perfectly legal to have negative array indices). In this case,
|
||||
the new key will be <literal>0</literal>. If no integer indices
|
||||
exist yet, the key will be <literal>0</literal> (zero). If you
|
||||
specify a key that already has a value assigned to it, that
|
||||
value will be overwritten.
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
|
@ -1534,11 +1535,10 @@ echo $foo[bar];
|
|||
constants which, unfortunately for your code, have the same
|
||||
name. It works because PHP automatically converts a
|
||||
<emphasis>bare string</emphasis> (an unquoted string which does
|
||||
not correspond to any known symbol, such as constants) into a
|
||||
string which contains the bare string. For instance, if there is
|
||||
no defined constant named <constant>bar</constant>, then PHP
|
||||
will substitute in the string <literal>'bar'</literal> and use
|
||||
that.
|
||||
not correspond to any known symbol) into a string which contains
|
||||
the bare string. For instance, if there is no defined constant
|
||||
named <constant>bar</constant>, then PHP will substitute in the
|
||||
string <literal>'bar'</literal> and use that.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
|
|
Loading…
Reference in a new issue