Swap/exchange array keys php -


lets have array:

array (     [0] => 18208021789     [1] => ziggo-humax ihdr5050c     [2] => 191.90     [4] =>     [5] => foo bar } 

and want change replace place of [1] [5], result should have:

array (     [0] => 18208021789     [1] => foo bar     [2] => 191.90     [4] =>     [5] => ziggo-humax ihdr5050c } 

how can achieve php?

$tmp=$arr[1]; $arr[1]=$arr[5]; $arr[5]=$tmp; 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -