Advertisement
chcosta

test

Apr 16th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. $corp_resp1 =(array_map(null, ...array_chunk($corp_resp, $carCount)));
  2.  
  3. var_dump($corp_resp1); -> That is dynamic.
  4.  
  5. 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 } }
  6.  
  7. Divide the array like that
  8.  
  9. $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" }
  10.  
  11. $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 } }
  12.  
  13. Use each total for give a value of the following function:
  14.  
  15. $total[i] = (array_reduce((array_map(function($x, $y) { return $x * $y; },
  16. $corp_resp1, $corp_resp_template)),function($carry,$item){return $carry+=$item;},0));
  17.  
  18. print of corp_resp[0] and the value of $total[0]
  19.  
  20. print of corp_resp[1] and the value of $total[1]
  21.  
  22. print of corp_resp[i] and the value of $total[i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement