- var_dump: documentation ( source)
<?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());