PHP 8.2 – Die spannendsten Neuerungen
Inhaltsverzeichnis

<code>class Falsy
{
public function almostFalse(): bool { /* ... */ *}
public function almostTrue(): bool { /* ... */ *}
public function almostNull(): string|null { /* ... */ *}
}
</code><code>class Falsy
{
public function alwaysFalse(): false { /* ... */ *}
public function alwaysTrue(): true { /* ... */ *}
public function alwaysNull(): null { /* ... */ *}
}
</code><code>class BlogData
{
public readonly string $title;
public readonly Status $status;
public function __construct(string $title, Status $status)
{
$this->title = $title;
$this->status = $status;
}
}
</code><code>readonly class BlogData
{
public string $title;
public Status $status;
public function __construct(string $title, Status $status)
{
$this->title = $title;
$this->status = $status;
}
}
</code><code>class User
{
public $name;
}
$user = new User();
$user->last_name = 'Doe';
$user = new stdClass();
$user->last_name = 'Doe';
</code><code>class User
{
public $name;
}
$user = new User();
$user->last_name = 'Doe'; // Deprecation-Notiz
$user = new stdClass();
$user->last_name = 'Doe'; // Weiterhin erlaubt
</code>Bereit für den Wechsel?
Wechsle jetzt zu cyon für ein souveräneres und nachhaltigeres Internet.
Beteilige dich an der Diskussion
Bisher keine Kommentare