#44016 [Opn]: Key function documentation implies it only works for associative arrays

From: Date: Sat, 02 Feb 2008 22:11:19 +0000
Subject: #44016 [Opn]: Key function documentation implies it only works for associative arrays
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-498@lists.php.net to get a copy of this message
ID: 44016 User updated by: cythrawll at codeangel dot org -Summary: Key function documenation implies it only works for associative arrays Reported By: cythrawll at codeangel dot org Status: Open Bug Type: Documentation problem PHP Version: Irrelevant New Comment: fixed spelling Previous Comments: ------------------------------------------------------------------------ [2008-02-01 21:50:39] cythrawll at codeangel dot org 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 this bug report at http://bugs.php.net/?id=44016&edit=1

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