Skip to Content
Late Static Binding in php
oops code / August 11, 2018
class DB
protected static $table=’basetable’;
public function select()
echo “SELECT * FROM “.static::$table;
public function insert()
echo “Insert into “. static::$table;
class abc extends DB { protected static $table=”abc”;

class userAccounts extends DB {

protected static $xyz=”user_accounts”;
$accounts=new userAccounts();
$abc=new abc();

No comments yet, take the initiative.

Leave a Reply

Your email address will not be published.

PHPCODE © 2023