PHP: Filling in the 'gaps' in an array
- by aboved
Hey gurus,
I've got a php array (obtained through checkbox values in a form - as you know checkboxes only show up in the _POST variable when they are not set).
Array
(
[2] => 0,2
[3] => 0,3
)
I need a way to 'fill in' the gaps between the range 0-5. So above would look like (filling the empty spaces with '-1'. I tried array_merge() with an array filled with '-1' but that didn't work.
Array
(
[0] => -1
[2] => 0,2
[3] => 0,3
[4] => -1
[5] => -1
)
I think I may have gone down the wrong road with the problem I am trying to solve, but I have put too much time into this solution to back out - a feeling I am sure most of you are familiar with(!)
Cheers!