I have 2 arrays:
first[]:
Array
(
[First / Building] => code 100
[Second - Closed and Covered Cans] => code 200
)
second[]:
Array
(
[0] => 1,000.00
[1] => 2,000.00
[2] => 3,000.00
)
My desired out will be something like this :
final[]
Array
(
[First / Building] => code 100
(
[0] => 1,000.00
)
[Second - Closed and Covered Cans] => code 200
(
[0] => 2,000.00
)
)
(leave the [2] => 3,000.00 unmatched in this case)
If first[] count is > second[], let's say :
first[]
Array
(
[First / Building] => code 100
[Second - Closed and Covered Cans] => code 200
[Third - Closed and Covered Cans] => code 300
[Forth - Closed and Covered Cans] => code 400
)
second[]
Array
(
[0] => 1,000.00
[1] => 2,000.00
[2] => 3,000.00
)
My desired output :
final[]
Array
(
[First / Building] => code 100
(
[0] => 1,000.00
)
[Second - Closed and Covered Cans] => code 200
(
[0] => 2,000.00
)
[Third - Closed and Covered Cans] => code 300
(
[0] => 3,000.00
)
[Forth - Closed and Covered Cans] => code 400
(
)
)
(leave the forth with no value in this case)
All the time pair the values from first array with the ones from second array. I tryed with array_combine(), but that isn't viable since they have different count.
code 100and also an array."First / Building" => ['code' => 'code 100', 'price' => "1,000.00" ]