<?php class Database { private $sql; public function where($where) { $this->sql .= " where {$where}"; return $this; } public function order($order) { $this->sql .= " order by {$order}"; return $this; } public function limit($limit) { $this->sql .= " limit ({$limit})"; return $this; } public function go() { return $this->sql; } }$db = new Database();$stmt = $db->where('id=1 and name=2')->order('id DESC')->limit(10)->go(); ?>