PHP 8.0 快要出了

看到 WordPress 的這篇「WordPress and PHP 8.0」,看起來 PHP 8.0 快要出了:

PHP 8.0 is in the final stages of its release cycle. As of the publish date of this post, version 8.0 RC5 has been released, and the final release of PHP 8.0.0 is scheduled for November 26, 2020.

官網上已經有一些資料可以看了,不過記得畢竟還沒 release,裡面的資訊還有可能會修正:「Migrating from PHP 7.4.x to PHP 8.0.x」,最重要的應該還是「Backward Incompatible Changes」這邊,可以看到這次畢竟是主版號升級,精彩的不相容性應該會搞爆不少應用程式,像是開頭就提到的,對數字與文字之間的 == 行為改變:

比較好的作法是自己先轉型再用 === 比較,這個概念在各家程式語言都類似,loose comparison 只是方便而已...

Leave a Reply

Your email address will not be published. Required fields are marked *