Doc #79997 [NEW]: Completely wrong example output given

From: Date: Wed, 19 Aug 2020 14:41:29 +0000
Subject: Doc #79997 [NEW]: Completely wrong example output given
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17800@lists.php.net to get a copy of this message
From: yuriy dot naz at mserverone dot com Operating system: Linux PHP version: 7.3.21 Package: Documentation problem Bug Type: Documentation Problem Bug description:Completely wrong example output given Description: ------------ --- From manual page: https://php.net/function.arsort --- See "Example #1 arsort() example". Executing this example in the interactive console (php -a) gives completely different result: php > $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); php > asort($fruits); php > foreach ($fruits as $key => $val) { php { echo "$key = $val\n"; php { } c = apple b = banana d = lemon a = orange 1) expected: sorting by key actual: sorting by value 2) expected: sorting is ascending actual: sorting is descending Test script: --------------- <?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); arsort($fruits); foreach ($fruits as $key => $val) { echo "$key = $val\n"; } ?> Expected result: ---------------- I expect to see this output in the documentation: c = apple b = banana d = lemon a = orange Actual result: -------------- a = orange d = lemon b = banana c = apple -- Edit bug report at https://bugs.php.net/bug.php?id=79997&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79997&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79997&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79997&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79997&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79997&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79997&r=support Expected behavior: https://bugs.php.net/fix.php?id=79997&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79997&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79997&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79997&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79997&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79997&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79997&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79997&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79997&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79997&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79997&r=mysqlcfg

« previous php.doc.bugs (#17800) next »