7 Punkte von xguru 2020-11-27 | 2 Kommentare | Auf WhatsApp teilen
  • 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

 
galadbran 2020-11-28

Aktuell ist empty("0") => true, aber wie wird es in 8 sein?!

 
galadbran 2020-11-28

In 8 ist es immer noch genauso, haha