php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10551 array_switch ( permute the keys w/ values)
Submitted: 2001-04-29 08:38 UTC Modified: 2001-04-30 04:32 UTC
From: teo at gecadsoftware dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0 Latest CVS (29/04/2001) OS:
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: teo at gecadsoftware dot com
New email:
PHP Version: OS:

 

 [2001-04-29 08:38 UTC] teo at gecadsoftware dot com
I found myself with an array like
$a = array (0 => "Foo", 1 => "Bar" );

and thought it would be cool to be able to say 
$a = array_permute/switch ($a);

a being now: array ("Foo" => 0 , "Bar"=>1);
the value colision can use the style of extract() 3rd parameter.

what do you think?

-- teodor

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-30 04:32 UTC] cynic@php.net
RTFM: array_flip()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC