PHP 8.0 रिलीज़
(php.net)-
दो 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;
- Saner string to number comparisons
→ 0 == 'foobar' // false (पहले true था)
- अतिरिक्त: WeakMap क्लास, Stringable इंटरफेस,
str_contains(),str_starts_with(),str_ends_with()फ़ंक्शंस
2 टिप्पणियां
अभी
empty("0") => trueहै, तो 8 में क्या वाकई ऐसा होगा?!8 में भी वही है, हाहा