Monday 20 July 2015

Method Chaining



Method chaining allows you to simplify your syntax by connecting multiple functions. Consider this example:

$this->db->select('title')->from('tablename')->where('id', $id)->limit(10, 20);

$query = $this->db->get();
 
Note: Method chaining only works with PHP 5.

No comments:

Post a Comment