class Example {
    private static $table_name = "tblTable";

private function whatever() {
    $query = "SELECT * FROM self::$table_name";

    .  .  .

}
}

self::$table_name does not parse as tblTable, rather it looks for the table self::tblTable. How can I get this to parse correctly?

As I was writing this I realized I could:

$query = "SELECT * FROM " . self::$table_name;

However if there is still a way to include a scope resolution operator within a string I would like to know.

Thank you!

    It looks like you've pretty much got it sussed. Indeed, the latter code is a tiny smidgen faster, so all else being equal it would be preferred over variable interpolation.

      Write a Reply...