Pagination::offset PHP Method

offset() public method

Returns the current offset This is used for the slice() method together with the limit to get the correct items from collections
public offset ( ) : integer
return integer
    public function offset()
    {
        return $this->offset;
    }

Usage Example

 static function find_paginated($page = 1, $fields = "*", $where_clause = "", $order = "ASC")
 {
     $total_count = static::count_all();
     $pagination = new Pagination($page, $total_count, ITEMS_PER_PAGE);
     $query = "SELECT {$fields} FROM `" . static::$table_name . "` ";
     $query .= $where_clause;
     $query .= "ORDER BY `" . ID . "` {$order} ";
     $query .= "LIMIT " . ITEMS_PER_PAGE . " ";
     $query .= "OFFSET " . $pagination->offset();
     return static::find_by_query($query);
 }
All Usage Examples Of Pagination::offset