src/Observable.php
public function average(): Observable
    {
        return $this
            ->defaultIfEmpty(Observable::error(new \UnderflowException()))
            ->reduce(function ($a, $x) {
                static $count = 0;
                static $total = 0;

                $count++;
                $total += $x;

                return $total / $count;
            }, 0);
    }
public function average(): Observable
    {
        return $this
            ->defaultIfEmpty(Observable::error(new \UnderflowException()))
            ->reduce(function ($a, $x) {
                static $count = 0;
                static $total = 0;

                $count++;
                $total += $x;

                return $total / $count;
            }, 0);
    }
public function average ( ) : Observable { return $ this -> defaultIfEmpty ( Observable :: error ( new \ UnderflowException ( ) ) ) -> reduce ( function ( $ a , $ x ) { static $ count = 0 ; static $ total = 0 ; $ count ++ ; $ total += $ x ; return $ total / $ count ; } , 0 ) ; }
Computes the average of an observable sequence of values.

@return Observable

@demo average/average.php
@operator
@reactivex average
Computes the average of an observable sequence of values .