src/Query/FluentQuery.php
public function each( $number, $callback ) {

		$this->offset = 0;
		$this->count  = $number;

		$query = clone $this;

		do {

			$_query  = clone $query;
			$results = $query->results();

			foreach ( $results as $result ) {
				if ( $callback( $result ) === false ) {
					return false;
				}
			}

			$_query->offset += $number;
			$query          = $_query;

		} while ( $results->count() === $number );

		return true;
	}
public function each( $number, $callback ) {

		$this->offset = 0;
		$this->count  = $number;

		$query = clone $this;

		do {

			$_query  = clone $query;
			$results = $query->results();

			foreach ( $results as $result ) {
				if ( $callback( $result ) === false ) {
					return false;
				}
			}

			$_query->offset += $number;
			$query          = $_query;

		} while ( $results->count() === $number );

		return true;
	}
Execute a callback over every row, chunking by a certain number.

@since 2.0

@param int      $number
@param callable $callback

@return bool