I'm attempting to learn codeigniter for php and I've come across this block of code where it seems the instructor is trying to change a constant variable. First I'm clueless as to why the curly braces are used and then I'm curious as to exactly what is going on with that constant variable.
<?php
class MY_Model extends CI_Model {
const DB_TABLE = 'abstract';
const DB_TABLE_PK = 'abstract';
private function insert() {
$this->db->insert($this::DB_TABLE, $this);
$this->{$this::DB_TABLE_PK} = $this->db->insert_id();
}
}
?>
Can someone please explain not only the use of curly braces here, but also how it's possible to assign a new value to the defined constant?