Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 447

Sum two array rows in PHP on a single line

$
0
0

I remember once I came across some website where sum of 2 arrays items was performed on a single line using array_sum and array_map functions. Does anyone know how to do that?

$a=array(1,2,3,4,5);$b=array(0,1,0,1,0);$result=compoundedSinlgeLineFunction($a,$b);$result=array(1,3,3,5,5); //this is what we get

Viewing all articles
Browse latest Browse all 447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>