class Database
{
const dbName = 'user';
const column = 'id';
public function __construct()
{
・・・
$query = "CREATE TABLE {self::dbName} ({self::column} INT)";
・・・
}
};
PHP で、↑のように、文字列定義の中にオブジェクト定数を埋め込む記述が出来ないものか、けっこう調べてみたけど、今は出来ないっぽい。無念。
