Skip to main content

Posts

Showing posts from July, 2018

PHP Chaining Function

PHP 4 - 7, Offers Chaining Function With Slight Differences, but this Post and Example Focuses on PHP 7's. Study the Example Below, Take note of the Power Array, Contatenation and Conditional Statements Have <?php class DBManager {     private $selectables = array();     private $table;     private $whereClause;     private $orderClause;     private $limit;     public function select() {         $this->selectables = func_get_args();         return $this;     }     public function from($table) {         $this->table = $table;         return $this;     }     public function where($where) {         $this->whereClause = $where;         return $this;     }     public function order($type) {         $this->orderClause = strtoupper($type);         return $this;     }     public function limit($limit) {         $this->limit = $limit;         return $this;     }     public function result() {         $query[] = "SELECT";         // if the selectables array is e