How could I make string interpolation with constants?
I tried with this code but it seems it not working:
class DB{
const DBNAME = "test";
private $host = "localhost";
public function __construct(){
$connectionString = "dbname={DB::DBNAME}"; //with will not work
$connectionString = "host={$this->host}"; //no problem with this
}
}
Is there a way to do string interpolation with constants?