From 4e856cd765949536e79c0bbfafc08028e3369d04 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Sun, 18 Nov 2001 23:45:19 +0000 Subject: [PATCH] reformated some of the examples to contain the expected output as within the instead of adding a second or with the results in a element git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@62753 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/array.xml | 122 ++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 67 deletions(-) diff --git a/functions/array.xml b/functions/array.xml index 20e346df78..75a25a559c 100644 --- a/functions/array.xml +++ b/functions/array.xml @@ -1,5 +1,5 @@ - + Array Functions Arrays @@ -91,10 +91,9 @@ $array = array( 1, 1, 1, 1, 1, 8=>1, 4=>1, 19, 3=>13); print_r($array); ]]> - - which will display : - - + + will display : + 19 ) ]]> - - + + + 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); ]]> - - which will display : - - + + will display : + 'March' ) ]]> - - + + + See also: list. @@ -169,19 +169,17 @@ Array CASE_LOWER. The function will leave number indices as is. - - - <function>array_change_key_case</function> example - + + <function>array_change_key_case</function> example + 1, "SecOnd" => 4); print_r(array_change_key_case($input_array, CASE_UPPER); ]]> - - - The printout of the above program will be: - - + + + The printout of the above program will be: + 2 ) ]]> - - - + + + @@ -225,20 +223,18 @@ Array indicies will be used in each resulting array with indices starting from zero. The default is &false;. - - - <function>array_chunk</function> example - + + <function>array_chunk</function> example + - - - The printout of the above program will be: - - + + + The printout of the above program will be: + - - - + + + @@ -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. - - <function>arsort</function> example - + + + <function>arsort</function> example + "lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); arsort ($fruits); @@ -2015,24 +2012,19 @@ while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } ]]> - - - - - This example would display: - - - - + + + This example would display: + - - - + + + 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. - - <function>asort</function> example - + + + <function>asort</function> example + "lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); asort ($fruits); @@ -2081,24 +2074,19 @@ while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } ]]> - - - - - This example would display: - - - - + + + This example would display: + - - - + + + The fruits have been sorted in alphabetical order, and the index associated with each element has been maintained.