Prints average of a stream of numbers
function streamAvg ( $ arr , $ n ) { $ avg = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ avg = getAvg ( $ avg , $ arr [ $ i ] , $ i ) ; echo " Average ▁ of ▁ " , $ i + 1 , " numbers ▁ is ▁ " , $ avg , " STRNEWLINE " ; } return ; }