PHP 8.0 veröffentlicht
(php.net)-
Geschwindigkeitsverbesserung durch zwei JIT-Engines: Tracing JIT + Function JIT
-
Verbesserungen beim Typsystem und bei der Fehlerbehandlung
-
Named Arguments
→ htmlspecialchars($string, double_encode: false);
- Attributes
→ #[Route("/api/posts/{id}", methods: ["GET"])]
- Constructor Property Promotion
→ __construct( public float $x = 0.0 ) {}
- Union Type
→ private int|float $number
- Match Expression
→ match (8.0) { '8.0' => "Oh no!", 8.0 => "This is what I expected", };
- Nullsafe-Operator
→ $country = $session?->user?->getAddress()?->country;
- Sinnvollerer Vergleich von Strings mit Zahlen
→ 0 == 'foobar' // false (früher war es true)
- Zusätzlich: WeakMap-Klasse, Stringable-Interface sowie die Funktionen
str_contains(),str_starts_with(),str_ends_with()
2 Kommentare
Aktuell ist
empty("0") => true, aber wie wird es in 8 sein?!In 8 ist es immer noch genauso, haha