I have an array that could contain zero values.
$array = array(3=> 1000, 5=> 0, 6=> 5000, 7 => 0);
Since the code that uses that array can't manage fields set as 0, I need to remove them. (I thought to store the field with 0 as value in a temp array):
$zero_array = array();
foreach ($array as $k => $s) {
$zero_array[$k] = $k;
unset($stack[$k]);
}
After the core code has runned I want to put back the filed that had 0 as value in the same position as they were.
The core code returns an array like this:
$output = array(3 => 10, 6 => 50);
I'd like to add the old keys and get this:
$output = array(3 => 10, 5 => 0, 6 => 50, 7 => 0);