Hi Friends!

Can you people help me out about this

I have Two Array's

1:
a[]
=>1
=>3
=>4

2:
b[]
=>5
=>6
=>8

and I want to combine both array like this

c[1]=5
c[3]=6
c[4]=8


Means the value of first array will be the Index of Third array
and the the Values of the Second array will be the Values of Third array


Thanks in Advanced!

Recommended Answers

All 2 Replies

Use php function : array_combine ( array $keys , array $values )

So in this case it would be

$c = array();

$c = array_combine($a, $b);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.