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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC