Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $corp_resp1 =(array_map(null, ...array_chunk($corp_resp, $carCount)));
- var_dump($corp_resp1); -> That is dynamic.
- array(2) { [0]=> array(9) { [0]=> array(0) { } [1]=> string(4) "0.00" [2]=> string(4) "0.00" [3]=> string(4) "0.75" [4]=> string(4) "0.00" [5]=> string(4) "0.00" [6]=> string(4) "0.60" [7]=> string(4) "0.00" [8]=> string(4) "0.00" } [1]=> array(9) { [0]=> string(4) "0.00" [1]=> string(4) "0.50" [2]=> string(4) "0.00" [3]=> string(4) "0.00" [4]=> string(4) "0.00" [5]=> string(4) "0.00" [6]=> string(4) "0.00" [7]=> string(4) "0.00" [8]=> NULL } }
- Divide the array like that
- $corp_resp[0] = [0]=> array(9) { [0]=> array(0) { } [1]=> string(4) "0.00" [2]=> string(4) "0.00" [3]=> string(4) "0.75" [4]=> string(4) "0.00" [5]=> string(4) "0.00" [6]=> string(4) "0.60" [7]=> string(4) "0.00" [8]=> string(4) "0.00" }
- $corp_reso[1] = { [0]=> string(4) "0.00" [1]=> string(4) "0.50" [2]=> string(4) "0.00" [3]=> string(4) "0.00" [4]=> string(4) "0.00" [5]=> string(4) "0.00" [6]=> string(4) "0.00" [7]=> string(4) "0.00" [8]=> NULL } }
- Use each total for give a value of the following function:
- $total[i] = (array_reduce((array_map(function($x, $y) { return $x * $y; },
- $corp_resp1, $corp_resp_template)),function($carry,$item){return $carry+=$item;},0));
- print of corp_resp[0] and the value of $total[0]
- print of corp_resp[1] and the value of $total[1]
- print of corp_resp[i] and the value of $total[i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement