PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php class A { private $sql = null; public function setSQL() { $this->sql = "SELECT * FROM users WHERE id = 123"; return $this; } public function getSQL() { return $this->sql; } } class B extends A { public function addSQL() { $this->sql .= " AND name = 'Alex'"; return $this; } } $a = new A(); $b = new B(); echo $b->setSQL()->addSQL()->getSQL();
Show:  
Copy Clear