- Output for 8.1.8 - 8.1.33, 8.2.10 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- string(11) "mydb_nobody"
<?php
class Foo
{
protected string $dbname;
public function __construct(array $appdata)
{
$this->dbname = 'mydb_' . $appdata['id'];
}
public function debug(): string
{
return $this->dbname;
}
}
$appdata = [
'id' => $_ENV['USER'],
];
$foo = new Foo($appdata);
var_dump($foo->debug());