#44016 [NEW]: Key function documenation implies it only works for associative arrays

From: Date: Fri, 01 Feb 2008 21:50:39 +0000
Subject: #44016 [NEW]: Key function documenation implies it only works for associative arrays
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-494@lists.php.net to get a copy of this message
From: cythrawll at codeangel dot org Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Key function documenation implies it only works for associative arrays Description: ------------ Documentation for key() function suggests it works only for associative arrays, however it works for both numerical and associative. PHP Manual for key() function states for the short description: key — Fetch a key from an associative array Reproduce code: --------------- <?php $arr = array("test", "test2"); reset($arr); echo key($arr); next($arr); echo key($arr); ?> Expected result: ---------------- key — Fetch a key from an array Actual result: -------------- key — Fetch a key from an associative array -- Edit bug report at http://bugs.php.net/?id=44016&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=44016&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44016&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44016&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44016&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44016&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44016&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44016&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44016&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44016&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44016&r=support Expected behavior: http://bugs.php.net/fix.php?id=44016&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44016&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44016&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44016&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44016&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=44016&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44016&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44016&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44016&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44016&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44016&r=mysqlcfg

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