Change position of elements in an associative array in php -


i have associative array :

$headers= array (     [module_id] => module id     [platform_id] => platform id     [package_guid] => package guid     [aggregate_package] => aggregate package     [deld] => deld ) 

now wish change position ofpackage id @ top resemble :

 $desired= array (     [package_guid] => package guid     [module_id] => module id     [platform_id] => platform id     [aggregate_package] => aggregate package     [deld] => deld ) 

i tried array_unshift method not works in case associative array.

unset($headers['package_guid']); array_unshift($headers, 'package_guid'); 

how can achieve it? thanks.

unset($headers['package_guid']); array_unshift($headers, array('package_guid' => 'package guid')); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -