- var_dump: documentation ( source)
<?php
class ManagerSupervisorV1 {
private string $name;
private float $salary;
public function __construct(string $name = 'Руководитель менеджеров', float $salary = 1.5) {
$this->name = $name;
$this->salary = $salary;
}
}
var_dump(new ManagerSupervisorV1);
class ManagerSupervisorV2 {
private string $name = 'Руководитель менеджеров';
private float $salary = 1.5;
public function __construct(string $name = null, float $salary = null) {
$this->name = $this->name ?: $name;
$this->salary = $this->salary ?: $salary;
}
}
var_dump(new ManagerSupervisorV2);
class ManagerSupervisorV3 {
public function __construct(
private string $name = 'Руководитель менеджеров',
private float $salary = 1.5,
) {}
}
var_dump(new ManagerSupervisorV3);