mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
reformated some of the examples to contain the expected output
as <screen> within the <example> instead of adding a second <example> or <informalexample> with the results in a <programlisting> element git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@62753 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
f3677d4d70
commit
4e856cd765
1 changed files with 55 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.123 $ -->
|
||||
<!-- $Revision: 1.124 $ -->
|
||||
<reference id="ref.array">
|
||||
<title>Array Functions</title>
|
||||
<titleabbrev>Arrays</titleabbrev>
|
||||
|
@ -91,10 +91,9 @@ $array = array( 1, 1, 1, 1, 1, 8=>1, 4=>1, 19, 3=>13);
|
|||
print_r($array);
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
which will display :
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<para>
|
||||
will display :
|
||||
<screen role="php">
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -107,8 +106,9 @@ Array
|
|||
[9] => 19
|
||||
)
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</screen>
|
||||
</para>
|
||||
</example>
|
||||
Note that index '3' is defined twice, and keep its final value of 13.
|
||||
Index 4 is defined after index 8, and next generated index (value 19)
|
||||
is 9, since biggest index was 8.
|
||||
|
@ -123,10 +123,9 @@ $firstquarter = array(1 => 'January', 'February', 'March');
|
|||
print_r($firstquarter);
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
which will display :
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<para>
|
||||
will display :
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -135,8 +134,9 @@ Array
|
|||
[3] => 'March'
|
||||
)
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</screen>
|
||||
</para>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also: <function>list</function>.
|
||||
|
@ -169,19 +169,17 @@ Array
|
|||
<constant>CASE_LOWER</constant>. The function will leave
|
||||
number indices as is.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>array_change_key_case</function> example</title>
|
||||
<programlisting role="php">
|
||||
<example>
|
||||
<title><function>array_change_key_case</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$input_array = array("FirSt" => 1, "SecOnd" => 4);
|
||||
print_r(array_change_key_case($input_array, CASE_UPPER);
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
The printout of the above program will be:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -189,9 +187,9 @@ Array
|
|||
[SECOND] => 2
|
||||
)
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</screen>
|
||||
</para>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
@ -225,20 +223,18 @@ Array
|
|||
indicies will be used in each resulting array with
|
||||
indices starting from zero. The default is &false;.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>array_chunk</function> example</title>
|
||||
<programlisting role="php">
|
||||
<example>
|
||||
<title><function>array_chunk</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$input_array = array('a', 'b', 'c', 'd', 'e');
|
||||
print_r(array_chunk($input_array, 2));
|
||||
print_r(array_chunk($input_array, 2, TRUE));
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
The printout of the above program will be:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
|
@ -281,9 +277,9 @@ Array
|
|||
|
||||
)
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</screen>
|
||||
</para>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
@ -2004,9 +2000,10 @@ array_walk ($fruits, 'test_print');
|
|||
their correlation with the array elements they are associated
|
||||
with. This is used mainly when sorting associative arrays where
|
||||
the actual element order is significant.
|
||||
<example>
|
||||
<title><function>arsort</function> example</title>
|
||||
<programlisting role="php">
|
||||
</para>
|
||||
<example>
|
||||
<title><function>arsort</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
arsort ($fruits);
|
||||
|
@ -2015,24 +2012,19 @@ while (list ($key, $val) = each ($fruits)) {
|
|||
echo "$key = $val\n";
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
This example would display:
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<para>
|
||||
This example would display:
|
||||
<screen>
|
||||
<![CDATA[
|
||||
a = orange
|
||||
d = lemon
|
||||
b = banana
|
||||
c = apple
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</screen>
|
||||
</para>
|
||||
</example>
|
||||
<para>
|
||||
The fruits have been sorted in reverse alphabetical order, and
|
||||
the index associated with each element has been maintained.
|
||||
|
@ -2070,9 +2062,10 @@ c = apple
|
|||
their correlation with the array elements they are associated
|
||||
with. This is used mainly when sorting associative arrays where
|
||||
the actual element order is significant.
|
||||
<example>
|
||||
<title><function>asort</function> example</title>
|
||||
<programlisting role="php">
|
||||
</para>
|
||||
<example>
|
||||
<title><function>asort</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
asort ($fruits);
|
||||
|
@ -2081,24 +2074,19 @@ while (list ($key, $val) = each ($fruits)) {
|
|||
echo "$key = $val\n";
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
This example would display:
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<para>
|
||||
This example would display:
|
||||
<screen>
|
||||
<![CDATA[
|
||||
c = apple
|
||||
b = banana
|
||||
d = lemon
|
||||
a = orange
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</screen>
|
||||
</para>
|
||||
</example>
|
||||
<para>
|
||||
The fruits have been sorted in alphabetical order, and the index
|
||||
associated with each element has been maintained.
|
||||
|
|
Loading…
Reference in a new issue