7 poin oleh xguru 2020-11-27 | 2 komentar | Bagikan ke WhatsApp
  • Peningkatan kecepatan dengan dua engine JIT: Tracing JIT + Function JIT

  • Peningkatan sistem tipe dan penanganan error

  • 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;

  • Perbandingan string ke angka yang lebih masuk akal

→ 0 == 'foobar' // false (sebelumnya true)

  • Tambahan: kelas WeakMap, interface Stringable, fungsi str_contains(), str_starts_with(), str_ends_with()

2 komentar

 
galadbran 2020-11-28

Sekarang empty("0") => true, tapi bagaimana nanti di 8?!

 
galadbran 2020-11-28

Di 8 juga tetap sama ya wkwk