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 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

Pull Requests

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: Thu Nov 28 10:01:29 2024 UTC