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

PHP8をざっくり解説してみる

 PHP8をざっくり解説してみる

大塚真言

January 23, 2021
Tweet

More Decks by 大塚真言

Other Decks in Programming

Transcript

  1. PHP8Λͬ͘͟Γղઆͯ͠ΈΔ
    2021/1/22 WebφΠτٶ࡚ vol.12
    େ௩ਅݴ

    View full-size slide

  2. ࣗݾ঺հ
    -BSBWFM
    7VFKT
    'JSFCBTF
    α΢φେ޷͖ͳ8FCΤϯδχΞ

    View full-size slide

  3. ձࣾ঺հ
    ߹ಉձࣾϊϚυϦ
    ૑ۀظ໨
    ϝϯόʔ໊
    8FCαʔϏε։ൃ
    &$αΠτ։ൃ

    View full-size slide

  4. 2020೥11݄26೔͸
    Կͷ೔ʁ

    View full-size slide

  5. ๻ͷ஀ੜ೔

    View full-size slide

  6. PHP8ͷ஀ੜ೔
    ʢϦϦʔε೔ʣ










    View full-size slide

  7. ओͳมߋ఺
    • JITίϯύΠϧʹΑΔੑೳվળ
    • Nullsafeԋࢉࢠʢψϧ҆શΦϖϨʔλʣ
    • Unionܕ
    • Matchࣜ
    • ଞʹ΋ଟ਺

    View full-size slide

  8. ͦͷલʹ
    Ξϯέʔτ

    View full-size slide

  9. ͲͷόʔδϣϯΛ࢖ͬͯΔʁ
    1. PHP 5.x
    2. PHP 7.0ʙ7.2
    3. PHP 7.3ʙ7.4
    4. PHP 8.0

    View full-size slide












  10. ҎԼ
    7.4
    7.3
    7.2
    7.0-7.1
    5.6
    5.5ҎԼ
    IUUQTXUFDITDPNUFDIOPMPHJFTEFUBJMTQMQIQ
    όʔδϣϯ͝ͱͷ࢖༻཰

    View full-size slide

  11. PHP8ͷ৽ػೳ

    View full-size slide

  12. JITίϯύΠϧ
    • JITʢJust-in-Time Compilerʣ˞࣮ߦ࣌ίϯύΠϥ
    • ίʔυΛϝϞϦʔʹΩϟογϡ͢ΔOPCacheͱซ༻
    • ωΠςΟϒίʔυΛϝϞϦʔʹΩϟογϡ͢Δ͜ͱͰϓϩ
    άϥϜ࣮ߦΛߴ଎Խ
    • ΞϧΰϦζϜܥॲཧͰ͸2~3ഒఔ౓࣮ߦ଎౓͸޲্͕ͨ͠ɺ
    WordPressͳͲͷWebΞϓϦέʔγϣϯͰ͸਺%ఔ౓͔͠
    ޲্͠ͳ͍

    View full-size slide

  13. Nullsafeԋࢉࢠ
    DPVOUSZOVMM
    JG TFTTJPOOVMM
    \
    VTFSTFTTJPOVTFS
    JG VTFSOVMM
    \
    BEESFTTVTFSHFU"EESFTT


    JG BEESFTTOVMM
    \
    DPVOUSZBEESFTTDPVOUSZ
    ^
    ^
    ^
    DPVOUSZTFTTJPO VTFS HFU"EESFTT
    DPVOUSZ
    1)1
    1)1
    ifจʹΑΔnullνΣοΫ͕ෆཁʹͳΔ

    View full-size slide

  14. Unionܕ

    !QBSBNqPBUcJOUOVNCFS

    QVCMJDGVODUJPOTBNQMF OVNCFS
    \
    FDIPOVNCFS
    ^
    UIJTTBNQMF UFHFIPHF
    ࣮ߦՄೳ
    QVCMJDGVODUJPOTBNQMF qPBUcJOUOVNCFS
    \
    FDIPOVNCFS
    ^
    UIJTTBNQMF UFHFIPHF
    ࣮ߦΤϥʔ
    1)1
    1)1
    ࣮ߦ࣌ʹUnionܕͷܕνΣοΫ͕Ͱ͖Δ
    1)1Ͱ͸Ξϊςʔγϣϯ
    ʹΑΔิ׬

    View full-size slide

  15. Matchࣜ
    TXJUDI
    \
    DBTF
    SFTVMU0IOP
    CSFBL
    DBTF
    SFTVMU5IJTJTXIBU*FYQFDUFE
    CSFBL
    ^
    FDIPSFTVMU
    0IOP
    FDIPNBUDI
    \
    0IOP
    5IJTJTXIBU*FYQFDUFE
    ^
    5IJTJTXIBU*FYQFDUFE
    1)1
    1)1
    ݫີͳൺֱɺbreakจ͕ෆཁ

    View full-size slide

  16. ·ͱΊ
    • JITίϯύΠϧ͕ಋೖ͞Ε͕ͨɺ࣮ӡ༻ͷWebΞ
    ϓϦ΁ͷੑೳ޲্͸͋·Γظ଴Ͱ͖ͳ͍
    • Matchࣜ΍NullsafeԋࢉࢠΛ࢖͏͜ͱͰεϦϜ
    ͳίʔυΛॻ͚Δ
    • Unionܕ͕௥Ճ͞ΕɺܕγεςϜ͕ΑΓڧݻʹ
    ͳͬͨ

    View full-size slide

  17. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ

    View full-size slide