public function getName($id) { if ($id > 1000) { $obj = new UserDb($id); } else { $obj = new UserFile($id); } return $obj->getName(); }