php - fill an array with missing values and keys -
I have this array $ all_zones
which sometimes comes with the missing keys and values And I want to fill the array with empty values for disturbing keys, here's the array:
This is $ all_zones [$ key] ['price']
on how many categories
for each region Depending on this, in this case $ range_count = count ($ all_ranges);
will display 2
, so I'd like to fill the missing keys for ' 2
: Here's the output:
Array ([0] => array ([id_zone] => 1 [name] => Europe [value] => Array ([0] => 3.00 [1] => ; 6.00) [id_delivery] => Hey ([0] => 1 [1] => 2)) [1] => Array ([id_jon] => 3 [name] => Asia [value] = & gt; Hey ([0] => [1] = & gt;) [ID_delivery] => Array ([0] => [1] = & gt; )) [2] = & gt; Array ([id_zone] = & gt; 4 [name] => Africa [value] => Array ([0] => 3.00 [1] = & gt; ; 6.00) [id_delivery] = & gt; array ([0] = & gt ; 3 [1] = & gt; 4)) [3] => Array ([id_zone] => 5 [name] = & gt; Oceania [value] => Array ([0] = & Gt; [1] = & gt;) [id_delivery] = & gt; Hey ([0] = & gt; [1] = & gt;)))
Even here That I have tried so far and have not succeeded:
Any help with this? much appreciated.
try this
$ range_count = count ($ all_ranges) ; Foreign currency ($ all_zones $ key = & gt; $ value) {if (isset ($ value ['id_zone']) and isset ($ value ['name']) & amp; (! Isset ($ value) ['Value']) | | isset ($ value [id_delivery ']))) {$ disabled [] = $ key; If ($ ([$ value ['price'])) {for ($ i = 0; $ i & lt; $ range_count & lt; $ i ++) {$ all_zones [$ key] ['id_delivery'] [ ] = '';}} For ['$ Id_delivery']) {$ i = 0; $ I & lt; $ Range_count & lt; $ I ++} {$ all_zones [$ key] ['id_delivery'] [] = '';}}}}
Comments
Post a Comment