mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
Fixed typo in the code I just modified, and also did a search and replace
of all the => and -> to use the > entity instead. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@32277 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
136f5cc464
commit
09cfe326ae
1 changed files with 53 additions and 53 deletions
|
@ -53,9 +53,9 @@
|
|||
<title><function>Array</function> example</title>
|
||||
<programlisting role="php">
|
||||
$fruits = array (
|
||||
"fruits" => array ("a"=>"orange", "b"=>"banana", "c"=>"apple"),
|
||||
"numbers" => array (1, 2, 3, 4, 5, 6),
|
||||
"holes" => array ("first", 5 => "second", "third")
|
||||
"fruits" => array ("a"=>"orange", "b"=>"banana", "c"=>"apple"),
|
||||
"numbers" => array (1, 2, 3, 4, 5, 6),
|
||||
"holes" => array ("first", 5 => "second", "third")
|
||||
);
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -89,7 +89,7 @@ $fruits = array (
|
|||
<title><function>Array_count_values</function> example</title>
|
||||
<programlisting role="php">
|
||||
$array = array (1, "hello", 1, "world", "hello");
|
||||
array_count_values ($array); // returns array (1=>2, "hello"=>2, "world"=>1)
|
||||
array_count_values ($array); // returns array (1=>2, "hello"=>2, "world"=>1)
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
@ -123,8 +123,8 @@ array_count_values ($array); // returns array (1=>2, "hello"=>2, "world"=>1)
|
|||
<example>
|
||||
<title><function>Array_diff</function> example</title>
|
||||
<programlisting role="php">
|
||||
$array1 = array ("a" => "green", "red", "blue");
|
||||
$array2 = array ("b" => "green", "yellow", "red");
|
||||
$array1 = array ("a" => "green", "red", "blue");
|
||||
$array2 = array ("b" => "green", "yellow", "red");
|
||||
$result = array_diff ($array1, $array2);
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -194,15 +194,15 @@ $original = strtr ($str, $trans);
|
|||
<example>
|
||||
<title><function>Array_intersect</function> example</title>
|
||||
<programlisting role="php">
|
||||
$array1 = array ("a" => "green", "red", "blue");
|
||||
$array2 = array ("b" => "green", "yellow", "red");
|
||||
$array1 = array ("a" => "green", "red", "blue");
|
||||
$array2 = array ("b" => "green", "yellow", "red");
|
||||
$result = array_intersect ($array1, $array2);
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
This makes <varname>$result</varname> have <literal>array ("a"
|
||||
=> "green", "red");</literal>
|
||||
=> "green", "red");</literal>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>array_diff</function>.
|
||||
|
@ -241,7 +241,7 @@ $result = array_intersect ($array1, $array2);
|
|||
<example>
|
||||
<title><function>Array_keys</function> example</title>
|
||||
<programlisting role="php">
|
||||
$array = array (0 => 100, "color" => "red");
|
||||
$array = array (0 => 100, "color" => "red");
|
||||
array_keys ($array); // returns array (0, "color")
|
||||
|
||||
$array = array ("blue", "red", "green", "blue", "blue");
|
||||
|
@ -262,7 +262,7 @@ array_keys ($array, "blue"); // returns array (0, 3, 4)
|
|||
function array_keys($arr, $term="") {
|
||||
$t = array();
|
||||
while (list($k,$v) = each($arr)) {
|
||||
if ($term && $k != $term)
|
||||
if ($term && $v != $term)
|
||||
continue;
|
||||
$t[] = $k;
|
||||
}
|
||||
|
@ -310,15 +310,15 @@ function array_keys($arr, $term="") {
|
|||
<example>
|
||||
<title><function>array_merge</function> example</title>
|
||||
<programlisting role="php">
|
||||
$array1 = array ("color" => "red", 2, 4);
|
||||
$array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4);
|
||||
$array1 = array ("color" => "red", 2, 4);
|
||||
$array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4);
|
||||
array_merge ($array1, $array2);
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Resulting array will be <literal>array("color" => "green", 2, 4,
|
||||
"a", "b", "shape" => "trapezoid", 4)</literal>.
|
||||
Resulting array will be <literal>array("color" => "green", 2, 4,
|
||||
"a", "b", "shape" => "trapezoid", 4)</literal>.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>array_merge_recursive</function>.
|
||||
|
@ -360,15 +360,15 @@ array_merge ($array1, $array2);
|
|||
<example>
|
||||
<title><function>Array_merge_recursive</function> example</title>
|
||||
<programlisting role="php">
|
||||
$ar1 = array ("color" => array ("favorite" => "red"), 5);
|
||||
$ar2 = array (10, "color" => array ("favorite" => "green", "blue"));
|
||||
$ar1 = array ("color" => array ("favorite" => "red"), 5);
|
||||
$ar2 = array (10, "color" => array ("favorite" => "green", "blue"));
|
||||
$result = array_merge_recursive ($ar1, $ar2);
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Resulting array will be <literal>array ("color" => array
|
||||
("favorite" => array ("red", "green"), "blue"), 5, 10)</literal>.
|
||||
Resulting array will be <literal>array ("color" => array
|
||||
("favorite" => array ("red", "green"), "blue"), 5, 10)</literal>.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>array_merge</function>.
|
||||
|
@ -937,13 +937,13 @@ array_splice ($input, -1, 1, array("black", "maroon"));
|
|||
<example>
|
||||
<title><function>Array_unique</function> example</title>
|
||||
<programlisting role="php">
|
||||
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
|
||||
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
|
||||
$result = array_unique ($input);
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
This makes <varname>$result</varname> have <literal>array ("a" =>
|
||||
This makes <varname>$result</varname> have <literal>array ("a" =>
|
||||
"green", "red", "blue");</literal>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -1022,7 +1022,7 @@ array_unshift ($queue, "p4", "p5", "p6");
|
|||
<example>
|
||||
<title><function>Array_values</function> example</title>
|
||||
<programlisting role="php">
|
||||
$array = array ("size" => "XL", "color" => "gold");
|
||||
$array = array ("size" => "XL", "color" => "gold");
|
||||
array_values ($array); // returns array ("XL", "gold")
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -1108,7 +1108,7 @@ function array_values($arr) {
|
|||
<example>
|
||||
<title><function>Array_walk</function> example</title>
|
||||
<programlisting role="php">
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
|
||||
function test_alter (&$item1, $key, $prefix) {
|
||||
$item1 = "$prefix: $item1";
|
||||
|
@ -1158,7 +1158,7 @@ array_walk ($fruits, 'test_print');
|
|||
<example>
|
||||
<title><function>Arsort</function> example</title>
|
||||
<programlisting role="php">
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
arsort ($fruits);
|
||||
reset ($fruits);
|
||||
while (list ($key, $val) = each ($fruits)) {
|
||||
|
@ -1218,7 +1218,7 @@ fruits[c] = apple
|
|||
<example>
|
||||
<title><function>Asort</function> example</title>
|
||||
<programlisting role="php">
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
asort ($fruits);
|
||||
reset ($fruits);
|
||||
while (list ($key, $val) = each ($fruits)) {
|
||||
|
@ -1303,7 +1303,7 @@ $result = compact ("event", $location_vars);
|
|||
</programlisting>
|
||||
<para>
|
||||
After this, <varname>$result</varname> will be <literal>array ("event"
|
||||
=> "SIGGRAPH", "city" => "San Francisco", "state" => "CA")</literal>.
|
||||
=> "SIGGRAPH", "city" => "San Francisco", "state" => "CA")</literal>.
|
||||
</para>
|
||||
</example>
|
||||
</para>
|
||||
|
@ -1437,13 +1437,13 @@ $bar = each ($foo);
|
|||
<varname>$bar</varname> now contains the following key/value
|
||||
pairs:
|
||||
<itemizedlist spacing="compact">
|
||||
<listitem><simpara>0 => 0</simpara></listitem>
|
||||
<listitem><simpara>1 => 'bob'</simpara></listitem>
|
||||
<listitem><simpara>key => 0</simpara></listitem>
|
||||
<listitem><simpara>value => 'bob'</simpara></listitem>
|
||||
<listitem><simpara>0 => 0</simpara></listitem>
|
||||
<listitem><simpara>1 => 'bob'</simpara></listitem>
|
||||
<listitem><simpara>key => 0</simpara></listitem>
|
||||
<listitem><simpara>value => 'bob'</simpara></listitem>
|
||||
</itemizedlist>
|
||||
<programlisting role="php">
|
||||
$foo = array ("Robert" => "Bob", "Seppo" => "Sepi");
|
||||
$foo = array ("Robert" => "Bob", "Seppo" => "Sepi");
|
||||
$bar = each ($foo);
|
||||
</programlisting>
|
||||
</para>
|
||||
|
@ -1451,10 +1451,10 @@ $bar = each ($foo);
|
|||
<varname>$bar</varname> now contains the following key/value
|
||||
pairs:
|
||||
<itemizedlist spacing="compact">
|
||||
<listitem><simpara>0 => 'Robert'</simpara></listitem>
|
||||
<listitem><simpara>1 => 'Bob'</simpara></listitem>
|
||||
<listitem><simpara>key => 'Robert'</simpara></listitem>
|
||||
<listitem><simpara>value => 'Bob'</simpara></listitem>
|
||||
<listitem><simpara>0 => 'Robert'</simpara></listitem>
|
||||
<listitem><simpara>1 => 'Bob'</simpara></listitem>
|
||||
<listitem><simpara>key => 'Robert'</simpara></listitem>
|
||||
<listitem><simpara>value => 'Bob'</simpara></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</example>
|
||||
|
@ -1472,7 +1472,7 @@ $bar = each ($foo);
|
|||
echo "Values submitted via POST method:<br>";
|
||||
reset ($HTTP_POST_VARS);
|
||||
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
|
||||
echo "$key => $val<br>";
|
||||
echo "$key => $val<br>";
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -1617,9 +1617,9 @@ while (list ($key, $val) = each ($HTTP_POST_VARS)) {
|
|||
wddx_deserialize */
|
||||
|
||||
$size = "large";
|
||||
$var_array = array ("color" => "blue",
|
||||
"size" => "medium",
|
||||
"shape" => "sphere");
|
||||
$var_array = array ("color" => "blue",
|
||||
"size" => "medium",
|
||||
"shape" => "sphere");
|
||||
extract ($var_array, EXTR_PREFIX_SAME, "wddx");
|
||||
|
||||
print "$color, $size, $shape, $wddx_size\n";
|
||||
|
@ -1725,11 +1725,11 @@ if (in_array ("Irix", $os))
|
|||
<example>
|
||||
<title><function>Krsort</function> example</title>
|
||||
<programlisting role="php">
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
krsort ($fruits);
|
||||
reset ($fruits);
|
||||
while (list ($key, $val) = each ($fruits)) {
|
||||
echo "$key -> $val\n";
|
||||
echo "$key -> $val\n";
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -1782,11 +1782,11 @@ fruits[a] = orange
|
|||
<example>
|
||||
<title><function>Ksort</function> example</title>
|
||||
<programlisting role="php">
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
|
||||
ksort ($fruits);
|
||||
reset ($fruits);
|
||||
while (list ($key, $val) = each ($fruits)) {
|
||||
echo "$key -> $val\n";
|
||||
echo "$key -> $val\n";
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -1914,19 +1914,19 @@ print_r($array2);
|
|||
Standard sorting
|
||||
Array
|
||||
(
|
||||
[0] => img1.png
|
||||
[1] => img10.png
|
||||
[2] => img12.png
|
||||
[3] => img2.png
|
||||
[0] => img1.png
|
||||
[1] => img10.png
|
||||
[2] => img12.png
|
||||
[3] => img2.png
|
||||
)
|
||||
|
||||
Natural order sorting
|
||||
Array
|
||||
(
|
||||
[3] => img1.png
|
||||
[2] => img2.png
|
||||
[1] => img10.png
|
||||
[0] => img12.png
|
||||
[3] => img1.png
|
||||
[2] => img2.png
|
||||
[1] => img10.png
|
||||
[0] => img12.png
|
||||
)
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -2172,7 +2172,7 @@ $fruits = array ("lemon", "orange", "banana", "apple");
|
|||
rsort ($fruits);
|
||||
reset ($fruits);
|
||||
while (list ($key, $val) = each ($fruits)) {
|
||||
echo "$key -> $val\n";
|
||||
echo "$key -> $val\n";
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -2412,7 +2412,7 @@ function cmp ($a, $b) {
|
|||
return ($a > $b) ? -1 : 1;
|
||||
}
|
||||
|
||||
$a = array (4 => "four", 3 => "three", 20 => "twenty", 10 => "ten");
|
||||
$a = array (4 => "four", 3 => "three", 20 => "twenty", 10 => "ten");
|
||||
|
||||
uksort ($a, "cmp");
|
||||
|
||||
|
|
Loading…
Reference in a new issue