Bug #60427 [Opn->Csd]: array_reverse docs are slightly misleading

From: Date: Fri, 02 Dec 2011 13:05:34 +0000
Subject: Bug #60427 [Opn->Csd]: array_reverse docs are slightly misleading
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7493@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60427&edit=1 ID: 60427 Updated by: gooh@php.net Reported by: me at andyclyde dot com Summary: array_reverse docs are slightly misleading -Status: Open +Status: Closed Type: Bug Package: Documentation problem Operating System: n/a PHP Version: Irrelevant -Assigned To: +Assigned To: gooh Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. I have added clarification that setting preserve_keys will only affect numeric keys. Non-numeric keys are always preserved, regardless of preserve_keys being true of false. Previous Comments: ------------------------------------------------------------------------ [2011-12-02 13:00:25] gooh@php.net Automatic comment from SVN on behalf of gooh Revision: http://svn.php.net/viewvc/?view=revision&revision=320282 Log: fixes Bug #60427: array_reverse docs are slightly misleading ------------------------------------------------------------------------ [2011-12-01 14:51:27] me at andyclyde dot com Description: ------------ The doc page for array_reverse() states that there is a second parameter "preserve_keys". In fact this doesn't seem to have any effect if the array is purely associative whatever you set the second parameter to. This behaviour seems fine but it's not obvious from the docs. I think this is possibly the same issue as bug #41396. Test script: --------------- $array = array( 'one' => 1, 'two' => 2 ); $array = array_reverse( $array, false ); var_dump( $array ); Expected result: ---------------- From the docs you might expect this to return: array(2) { ["one"]=> int(2) ["two"]=> int(1) } Actual result: -------------- array(2) { ["two"]=> int(2) ["one"]=> int(1) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60427&edit=1

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