Array-Functions

From: Date: Tue, 15 May 2001 19:07:26 +0000
Subject: Array-Functions
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969335296@lists.php.net to get a copy of this message
Hello all, while working on the de-translation of the array-functions, I've recognized the following: 1.) FUNCTION ARRAY_REVERSE: The mentioned "$result2" doesn't exist in the related example, it should be "$result_keyed": *** snip *** Example 1. Array_reverse() example $input = array ("php", 4.0, array ("green", "red")); $result = array_reverse ($input); $result_keyed = array_reverse ($input, TRUE); This makes $result have array (array ("green", "red"), 4.0, "php"). But $result2[0] is still "php". *** snip *** 2.) FUNCTION ARRAY_FLIP: http://www.php.net/manual/en/html/function.array-flip.html: Considering a beginner with no programming history, this description isn't easy to understand. Therefore I'd suggest a description like: **** snip *** array_flip -- Flip all the values of an array Description array array_flip (array array) Array_flip() returns an array where keys and values are flipped. Note that this function works only with string and integer values Example 1. Array_flip() $input = array ( "red", "green", "green" ); $result = array_flip ($input); This makes $result have array ( "red" => 0, "green" => 2 );. Note that "green" in result is unique (see Array()). See also Array_unique() and array_reverse(). **** snip *** 3.) COMETICS 1: Question to examples in general: The examples (throughout the whole phpdoc) are often stated like "<example> <title><function>Array_flip</function> example</title>", what makes in the manual "Example 1. Array_flip() example". Isn't that off-putting to the reader? Is that based on a special thought behind, or would it be better to delete/rename the "extra-example"? 4.) COSMETICS 2: The parameter-names are inconsistent: sometimes, we have function (array array), function (array arr), function (array input) Should I unify this? If everybody agrees on some or all of these (or new/better) suggestions, let me know, and I'll provide the adapted array.xml that somebody can commit it. best regards, Thomas

« previous php.doc (#969335296) next »