php - Put in array the result from arsort array with fatser method -


how can put in array result arsort array faster method ?

i have :

array (     [a] => 32389     [o] => 25534 ) 

i :

array (     [1] => array         ([0] => 'a',           [1] => '32389')      [2] => array         ([0] => 'o',           [1] => '25534') ) 

i :

$words = []; foreach($words $key=>$value) {     $words[] = [$k, $v]; } 

it works, after arsort, if (foreach($words $key => $value) better/faster method execute task or if there other method/function php ?

easy do:-

<?php $data = array (     'a' => 32389,     'o' => 25534 );  $new_data = array(); foreach ($data $key=>$value){ // iterate through original array     $new_data[] = array($key,$value); // assign key , value array new array } echo "<pre/>";print_r($new_data); // print new array ?> 

output:- https://eval.in/556504

based on question best solution (every 1 else use same things). there no matter of speed in above loop working.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -