Ian Littman
Blue-highlighted items are links if you want more info (ian.im/php84adm)
Info drawn from the release page + php.watch + UPGRADING and NEWS files
brew tap shivammathur/php
brew install php@8.4
class User
{
private bool $isModified = false;
public function __construct(private string $first, private string $last){}
public string $fullName {
// Override the "read" action with arbitrary logic.
get => $this->first . " " . $this->last;
// Override the "write" action with arbitrary logic.
set (string $value) {
[$this->first, $this->last] = explode(' ', $value, 2);
$this->isModified = true;
}
}
}
class User { public private(set) string $firstName; public private(set) string $lastName; public function setName(string $first, string $last) { $this->firstName = $first; $this->lastName = $last; } } $u = new User(); $u->setName('John', 'Smith'); echo $u->firstName . ' ' . $u->lastName . "\n"; // succeeds $u->firstName = 'Jane'; // fails