Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP8の事を調べてみました / hello-php8

PHP8の事を調べてみました / hello-php8

12月初頭に社内でちょっと話す機会があったので、
「タイミング的にホットじゃない??」ってことでPHP8の事を調べてみました

hideki kinjyo

December 12, 2020
Tweet

More Decks by hideki kinjyo

Other Decks in Programming

Transcript

  1. cite from [PHP: PHP \. \. Release Announcement](https://www.php.net/releases/ . /en.php)

    ͜ͷΞοϓσʔτʹ͸ɺ
 ͨ͘͞Μͷ৽ػೳ΍࠷దԽؚ͕·Ε͍ͯ·͢ɻ
  2. : Error \Throwable catch https://daisuki.nichiyoubi.land/entry/ / / / [phpconfuk ]

    - YouTube https://www.youtube.com/watch?v=QDbp cR Dc
  3. migration guide PHP: PHP . .x PHP . .x -

    Manual https://www.php.net/manual/ja/migration .php @rana_kualu PHP . PHP . - Qiita https://qiita.com/rana_kualu/items/fe fbe d d PHP . - Qiita https://qiita.com/rana_kualu/items/c cb c ee c php.watch PHP . : What's New and Changed PHP.Watch https://php.watch/versions/ .
  4. Attribute PHP Similar concepts exist in other languages named Annotations

    in Java, Attributes in C#, C++, Rust, Hack and Decorators in Python, Javascript. https://wiki.php.net/rfc/attributes_v doc-comment
  5. syntax `#[sukinamono]` class, property, method `#[Attribute]` attribute attribute Re ection

    attributeԽ Ҿ਺ΛऔΕΔ Reflectionܦ༝Ͱ
 ΞΫηε ௚Ͱinstanceੜ੒ ෳ਺OK
  6. syntax `#[sukinamono]` class, property, method `#[Attribute]` attribute attribute Re ection

    array(3) { ["name"]=> string(10) "MyNs\Attr1" ["args"]=> array(0) { } ["instance"]=> object(MyNs\Attr1)#4 (0) { } } array(3) { ["name"]=> string(10) "MyNs\Attr2" ["args"]=> array(1) { [0]=> int(10) } ["instance"]=> object(MyNs\Attr2)#4 (1) { ["value":"MyNs\Attr2":private]=> int(10) } }
  7. : PHP PHP Attribute - Shin x Blog https://blog.shin x

    .com/entry/history-of-php -attribute
  8. syntax `A|B|C` `void` false `A|false` `true` `A|true` (`bool` ) object(SpecialDay)#1

    (0) { } object(SpecialDay)#1 (0) { } Fatal error: Uncaught TypeError: SpecialDay::create(): Argument #1 ($dow) must be of type string|int, bool given, called in /in/oPlMf on line 17 and defined in /in/oPlMf:5 Stack trace: #0 /in/oPlMf(17): SpecialDay::create(false) #1 {main} thrown in /in/oPlMf on line 5
  9. $2

  10. = =

  11. DRY

  12. PHP

  13. ͜ͷลΓͷ࿩ .constructor property promotion .named arguments .match expression .nullsafe operator

    .throw expression .Non-capturing catches .str_contains(), str_starts_ with(), str_ends_with()
  14. named arguments Python `name:` `method($a, null, null, null, $z)` API

    array(3) { ["a"]=> int(1) ["b"]=> int(2) [“d"]=> int(20) }
  15. match expression switch case switch 釈(= ) (switch ) (`===`)

    OR `,` switch `break` Error string(14) "very happy day"
  16. throw expression C# `throw` NULL match Fatal error: Uncaught NotFoundException

    in /in/5NOp3:9 Stack trace: #0 {main} thrown in /in/5NOp3 on line 9
  17. str_contains(), str_starts_with(), str_ends_with() ( 0 false ) `strpos` array(3) {

    [0]=> bool(true) [1]=> bool(true) [2]=> bool(false) }
  18. $

  19. PHP

  20. PHP8จݙ • ެࣜͷmigration guide ◦ PHP: PHP 7.4.x ͔Β PHP

    8.0.x ΁ͷҠߦ - Manual https://www.php.net/manual/ja/ migration80.php • ͓ͳ͡Έ @rana_kualu͞Μ ◦ ʲPHP8.0ʳPHP8.0ͷ৽ػೳ - Qiita https://qiita.com/ rana_kualu/items/fe7998fbe773544d5d25] ◦ ΋͏1ͭ PHP8.0͕ϦϦʔε͞ΕͨͷͰ৽ػೳશ෦΍ Δ - Qiita https://qiita.com/rana_kualu/items/ c110cb244c3ee38c6859 • php.watch ◦ PHP 8.0: What's New and Changed • PHP.Watch https://php.watch/versions/8.0 • stitcher.io ◦ What's new in PHP 8 - stitcher.io https://stitcher.io/ blog/new-in-php-8 JIT • https://wiki.php.net/rfc/jit PHP: rfc:jit • https://hackmd.io/@hrxVDayfRGeTR-1JBV3QLA/Hk5oOkp4w ShowNoteɿʲΦϯϥΠϯʳPHPerʹΑΔ PHPerͷͨΊͷʮʰPHP8ʱͷχϡʔε΍هࣄΛޠΓ߹͏ʯTechCafe @ RAKUS 9݄ - HackMD • https://www.php.net/manual/ja/opcache.preloading.php PHP: ίʔυͷࣄલϩʔυ - Manual • https://www.slideshare.net/hnw/zend-opcache Zend OPcacheͷ଎͞ͷൿີΛ୳Δ • https://www.slideshare.net/hnw/opcache OPcacheͷ৽ػೳϑΝΠϧϕʔεΩϟογϡͷ಺෦࣮૷ΛಡΜͰ Έͨ • https://www.unitrust.co.jp/8752 PHP7.4Ͱಋೖ͞ΕΔPreload(ϓϦϩʔυ)ͬͯԿʁ | UNITRUST • https://tech.akat.info/?p=1371 PHP࣮ߦ·ͰͷྲྀΕͱOPcache – ๨ΕΔͨΊʹه͢ • https://www.slideshare.net/hirokawa/php2019-202563364 PHPͷࠓͱ͜Ε͔Β2019(ͷ#24ʙ) • https://japan.zdnet.com/article/35163100/ ʮPHP 8ʯϦϦʔεɺJITίϯύΠϥʔಋೖ͸ੋ͔ඇ͔ - ZDNet Japan • https://qiita.com/rana_kualu/items/ba312d2789bd228f887a ʲPHP8.0ʳPHPͰJIT͕࢖͑ΔΑ͏ʹͳΔ - Qiita • https://qiita.com/rana_kualu/items/73c346b3feadfa3a5b21 PHP8.0.0α1͕ϦϦʔε͞ΕͨͷͰͬͦ͘͞JIT ͷҖྗΛମײ͢Δ(ͨ͠) - Qiita • https://stitcher.io/blog/php-jit PHP 8: The JIT - stitcher.io • https://tech.fusic.co.jp/posts/2020-11-28-php8-jit-compared-speed-with-php7/ PHP8ͷJITΛ༗ޮʹͯ͠ɺ PHP7ͱ଎౓ൺֱ͢Δ - Fusic Tech Blog • https://php.watch/versions/8.0/JIT JIT - PHP 8.0 • PHP.Watch Attribute • https://tadsan.fanbox.cc/posts/1052551 PHP8 <>ΛޠΖ͏ #phpkansai ʛtadsanʛpixivFANBOX • https://stitcher.io/blog/attributes-in-php-8 PHP 8: Attributes - stitcher.io • https://qiita.com/rana_kualu/items/749c389a275f207a8e58 ʲPHP8.0ʳPHPͰΞτϦϏϡʔτ/Ξϊςʔ γϣϯ/σίϨʔλ͕ॻ͚ΔΑ͏ʹͳΔ - Qiita