7 คะแนน โดย xguru 2020-11-27 | 2 ความคิดเห็น | แชร์ทาง WhatsApp
  • ปรับปรุงความเร็วด้วย JIT engine สองตัว: Tracing JIT + Function JIT

  • ปรับปรุงระบบ type และการจัดการข้อผิดพลาด

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

  • การเปรียบเทียบ string กับ number ที่สมเหตุสมผลขึ้น

→ 0 == 'foobar' // false (เมื่อก่อนเป็น true)

  • เพิ่มเติม: คลาส WeakMap, อินเทอร์เฟซ Stringable, และฟังก์ชัน str_contains(), str_starts_with(), str_ends_with()

2 ความคิดเห็น

 
galadbran 2020-11-28

ตอนนี้ empty("0") => true แต่ในเวอร์ชัน 8 จะเป็นอย่างไร?!

 
galadbran 2020-11-28

ใน 8 ก็ยังเหมือนเดิมเลย 55