Suganya Rajasekar Suganya Rajasekar - 5 months ago 10
PHP Question

Combine two array values to make them key=>value format

I am having two arrays like this

Array
(
[0] => username
[1] => avatar
)
Array
(
[0] => name
[1] => 4.jpg
)


Here, I need to get these values in the following format

'username'=>name,'avatar'=>4.jpg


i.e., merge the same key values in the above format..

How should I do this,..Someone help me..

If you think that my title is wrong,Please change it into correct format.

Thanks,

Answer

use $c = array_combine($a, $b);

Comments