php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53468 example 1 for ksort(): match fruit names to index letters
Submitted: 2010-12-03 21:49 UTC Modified: 2010-12-03 21:54 UTC
From: ian at gumstix dot com Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS: not applicable
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ian at gumstix dot com
New email:
PHP Version: OS:

 

 [2010-12-03 21:49 UTC] ian at gumstix dot com
Description:
------------
---
From manual page: http://www.php.net/function.ksort#Examples
---

The example would be clearer if the first letter of each array value matched the corresponding array key, like so:

$fruits = array("l"=>"lemon", "c"=>"cranberry", "a"=>"apple", "b"=>"banana");

Then, when the output is shown, the reader can easily see that key => value mappings are preserved:

a = apple
b = banana
c = cranberry
l = lemon



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-03 21:54 UTC] danbrown@php.net
-Status: Open +Status: Wont fix
 [2010-12-03 21:54 UTC] danbrown@php.net
There's not enough need for that, and - if anything - could potentially introduce 
more of an issue by using a lower-case 'L' in the example.  It's worked fine for 
years.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Mar 15 07:01:29 2025 UTC