7 ポイント 投稿者 xguru 2020-11-27 | 2件のコメント | WhatsAppで共有
  • 2つのJITエンジンにより速度を改善 : Tracing JIT + Function JIT

  • 型システムとエラー処理の改善

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

  • より妥当な文字列と数値の比較

→ 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でもそのままですね(笑)