How to combine these two array into one array using php? -


this question has answer here:

given these 2 array:

$name=array("alice","ken","wendy");  $frequent=array(3,6,9);                                        

i try combine like

$data = array($name=>$frequent); 

but fails. can help?

i want this:

$data = array(       'alice' => 3,       'ken' => 6,       'wendy' => 9,  ); 

you can use array_combine

$combined_array = array_combine($name, $frequent); 

documentation here: http://php.net/manual/en/function.array-combine.php


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -