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

近況PHP / PHP in now a days

271fad8d53cd1f12f2b4b6d38e3d7bd3?s=47 uzulla
May 14, 2022

近況PHP / PHP in now a days

at: TechFeed Conference 2022
url: https://techfeed.io/events/techfeed-conference-2022
date: 2022/05/14
speaker: uzulla

271fad8d53cd1f12f2b4b6d38e3d7bd3?s=128

uzulla

May 14, 2022
Tweet

More Decks by uzulla

Other Decks in Programming

Transcript

  1. (ඇPHPer޲͚) ۙگ PHP uzulla @ TECHFEED CONFERENCE 2022 DISCLAIMERɿશ෦ओ؍

  2. @uzulla ϑϦʔͷ PHPer (͏ͣΒ) (RubyͰ͸ͳ͍ํ) PHP4ʙ8.1ରԠத

  3. ࠷ॳʹ·ͱΊ (·ͣ) ੜ͖࢒ͬͨɺγΣΞ੒௕ͱ·Ͱ͸ݴΘͳ͍͕ਰୀͰ΋ͳ͍ ރΕ͍ͯͳ͍(BCΛڪΕͳ͍ɺྗڧ͋͞ΔਐԽ) (ଞॴ͔ΒݟΕ͹पճ஗Εͷ)Ϟμϯ͞ΛΩϟονΞοϓத σΩΔਓͳΒ͙͢࢖͑Δखܰ͞͸ͦͷ··ʹݎ࣮ʹ Ͳ͜ʹͰ΋͋Δ͠ɺͲ͜Ͱ΋࢖ΘΕ͍ͯΔ

  4. ੜ͖࢒ͬͨ w े෼Ͱ͔͍γΣΞɺ଎౓ɺϥΠϒϥϦɺϑϨʔϜϫʔΫͷଘࡏ w ෆ଍͍ͯ͠Δͷ͸ɺઃܭͰ͖ΔΤϯδχΞ w ʮνϟϯεͰ͢Αʂʢ୭ʹݴͬͯΔΜͩʁʯ w ֤छϓϥοτϑΥʔϜͰ΋ɺϑΝʔετύʔιϯͰ͸ͳ͍͕ େ఍OE

    SE͋ͨΓʹ͸͍Δʢྫɿ-BNCEBͱ͔ʣ
  5. ੜ͖ͯΔ৔ॴ w ϋΠύϑΥʔϚϯεʮҎ֎ʯͷ΢ΣϒόοΫΤϯυ w ྫ8FCTPDLFU΍ϙʔϦϯάɺ$,ɺH31$౳Ҏ֎ w ݱ୅͸ඞཁͳॴ͚ͩڧ͍ݴޠΛ࢖͏ͷ͕ී௨ ʢྫΩϡʔ ϝοηʔδϒϩʔΧʔ͸ผݴޠ΍ϚωʔδυͰʣ w

    ͪΌΜͱͨ͠ݴޠΛ࢖͍͑ͯΔօ͞ΜͳΒ໰୊ແ͍೉қ౓
  6. ʮͳͥJava౳ʹ͠ͳ͍ͷ͔ʁʯ w ʮͷέʔεͰ+BWB΄ͲΊΜͲʜ߽՚ͳඞཁ͕ͳ͍͔Βʯ w ۪௚ͳݴޠͳͷͰɺૉ௚ͳίʔυͳΒσόοά͕͠΍͍͢ ʢ5ISFBEͱ͔$PSPVUJOFͱ͔ͳ͍ͷͰɺελοΫ͕γϯϓϧʣ w ೉ղͳϏϧυπʔϧ੔උ΍ίϯύΠϧ͕ෆཁͰ͋Δ w $PNQPTFS1BDLBHJTU͸.BWFOͱ͔/VHFUͱ͔ΑΓָʂʂʂʂ

    w ʮ೥લͷίʔυ͕ಈ͘͠ɺιʔε͕ඞͣಡΊΔʯ
  7. ਐԽͭͭ͋͠Δܕ w ෳࡶͳઃܭʹ଱͑ΒΕΔ͔ͬ͠Γͱͨ͠ݴޠ࢓༷ɺܕ w ʮ1)1͕͔ͬ͠Γͱͨ͠ݴޠʁʁʁʯ w ܕ΍Ϋϥεɺ&OVN౳վળɺ4QSFBE΍NBUDIࣜදݱྗͷ޲্ w ੩తղੳ͕ڧ͘ޮ͘ݴޠઃܭͱɺͦΕΛऔΓר͘πʔϧ w

    ͜ͷ͋ͨΓ͸UBETBOͷൃදͰ΍ΔΜ͡Όͳ͍͔φʁʁ
  8. ʮͰ΋ΏΔ;ΘܕͰ͠ΐʁʯ w Ҿ਺΍ฦΓ஋Ͱ͸ɺࠓ͸5ZQF&SSPSͰఀࢭͰ͖·͢ ɹɹdeclare(strict_types=1); // ๨Εͣʹ ɹɹ( fn(int $a) =>

    print($a) )("1"); // TypeError!! PHP Fatal error: ....Uncaught TypeError: ... must be of type int, string given
  9. ੩తղੳΛ͔͓ͭ͏ w ੩తղੳπʔϧ࢖͑͹array<int, T>·ͰͰ͖ΔΜͰ͢Α w ݱ୅ͷ1)1͸ɺ੩తղੳͰೋาࡾาઌʹڧ͘ͳΕΔ

  10. ʮಈతʯ͸ٻΊΒΕ͍ͯͳ͍ w new $class($param)໓ΜͰ΄͍͠ ݸਓͷײ૝ w JGจͰݻΊͳ͘ͱ΋؆ܿʹݎ͘ॻ͘͜ͱ͕Ͱ͖Δݱ୅ w 1010Ͱݎ͘ॻ͘ݶΓɺ͔ͬ͠Γͱͨ͠ίʔυ͕ॻ͚Δ w

    Ҿ͖ଓ͖ڐ͞ΕΔΏΔ;ΘίʔυͱΏΔ;ΘϑϨʔϜϫʔΫ w ͜ͷࠞࡏɾڥքΛͲ͏ཱ྆͢Δ͔͕ݱࡏͷ՝୊ͱࢥ͏ w ੲ͸ ࠓ΋ 1FSM΍3VCZ͕ત·͔͕ͬͨ͠ࠓ͸ҧ͏
  11. ڧԽ͞Ε͍ͯΔ΋ͷ w Ҿ͖ଓ͖$PNQPTFS1BDLBHJTUͳͲΤίγεςϜ w &OVNɺ6/*0/ܕͳͲॊೈɾιϦουͳݴޠ΁ͷมԽ͔ͭ ಈతͳ෺ "UUSJCVUF౳ ΋௥Ճʢ+BWB͍ݴޠʹͳΓͭͭ͋Δʣ w NBUDIࣜͱ͔ɺGO

    ͱ͔ɺTQSFBE΍SFBEPOMZͷ͓͠ΌΕ͞ ʁ w ྺ࢙తܦҢͷ࡟ݮʢ#$౳Λ൐͏Ϩϕϧͷվֵʣ w &'*ʢʮ1)1FSͩͬͯ$ϥΠϒϥϦୟ͖͍ͨΑͳʂʢʁʁʣʯʣ
  12. ਐԽ͠ͳ͍Ͱ͋Ζ͏΋ͷ w UISFBEɻωΠςΟϒεϨου͕ඞཁͳέʔε͕ͳ͍ w ʢຊ෺ͷʣ4JOHMFUPOɺϓϩηεΛ·ͨ͛ͳ͍ͷͰ͜ͳͦ͏ ʢ1SFGPSLϞσϧ͸ҡ࣋͞ΕΔͩΖ͏ʣ w ͨͩ͠ɺ$֦ுͰ͸ଘࡏ͠͏Δ͠ɺ͢Ͱʹ͋Δ w ࡢࠓ૿͑ͨɺόΠφϦσʔλͷૢ࡞

    w Ͱ͖ͳ͍Θ͚Ͱ͸ͳ͍͕ʜόΠφϦߏ଄ମ΄͍͠Ͷ
  13. ଍Γͳ͍΋ͷ w جຊతʹ͸ɺ 1SF GPSLͳͷͰʜ ݱ୅Ͱ͸ॏཁͳฒߦɾฒྻॲཧ͕·ͩෆಘҙ w ϥΠϒϥϦ͸͋Δ͕ɺσϑΝΫτ͕ͳ͍ w ʢࠓೖΕͯ೥ϨϕϧͰ௕ੜ͖͢Δ͔͕ෆ໌ʣ

    w 'JCFS͕ೖͬͨͷͰɺࠓޙվળ͞Ε͍͔ͯ͘΋͠Εͳ͍
  14. ଍Γͳ͍΋ͷ̎ w ʮIUUQEདྷͯ͘ΕʂίϯςφͰ໘౗ʂʯ "QBDIF QIQ΍QIQGQN w ͋Δʹ͸͋Δ w 4XPPMFɺ"NQɺ3FBDU ࣗݾIUUQE

    w 3PBE3VOOFS (P 1SFGPSL w FUD FUD w ඇ७ਖ਼ͳΒ৭ʑ͋Δ
  15. ݴޠʮ֎ʯͷਐԽ w ଞݴޠಉ༷ʹ3FRVFTU3FTQPOTFΦϒδΣΫτ͕ීٴ w 143  EFGBDUPͱ͸ݴ͍ͮΒ͍͕ɺม׵Ͱ͖Δ΋ͷ͕ଟ͍ w 84(*3BDL&YQSFTTతʹ ɺಠࣗ"QQ4FSWFS'8ͷ૬ޓޓ׵

    w ϓϩηεͰ/SFRΛ͞͹͘ɾ͚Δɺςετ͠΍͘͢ͳͬͨ w ແ࿦ɺݹ͍1)1ελΠϧͱ͸ܾผ͢Δඞཁ͸͋Δ ྫɿ$_GET, $_SESSION, echo "<html>"ͷഉআ
  16. վળ͞ΕͨΤϥʔॲཧ w Τϥʔͱྫ֎ɺฦΓ஋ɺget_hoge_last_error౳͕ ࠞͬͨࠞ͟ಱੈք͸ ֓ͶʜOPUશ෦ ऴΘͬͨ w ྫ֎ػߏͰѻ͑Δ5ISPXBCMFʹ౷߹͞Εͨͭͭ͋Δ w ࠓͰ͸ɺେମ͸ྫ֎ɾΤϥʔΛద੾ʹѻ͑Δ

    w େن໛όον΍αʔόʔϓϩάϥϜΛॻ͚Δ w ʢ1%0ͷ%#࠶઀ଓपΓ͕΋͏গ͠੔උ͞Εͯ΄͍͠ͳʜʣ
  17. ࡢࠓେมͳϙΠϯτ w -54ෆࡏʢϚΠφʔόʔδϣϯ͸ϚΠφʔόʔδϣϯͰ͸ͳ͍ʣ w ΠέͯΔػೳ͸૿͑Δ͕ɺͲΜͲΜͱ#$౳͕ൃੜ͢Δ w ʮͪΌΜͱςετॻ͚͹0,ʯʮͦΕͳʯ w ௥͍͔͚͍ͯ͘ίετ͕ඞཁ &0-·Ͱʙ೥

    w ΑΓςελϒϧɺΑΓૄ݁߹ͳઃܭʹ͠ͳ͍ͱӬԕʹ͍ۤ͠ w ʢૉ௚ͳίʔυͳΒͦ͜·ͰखؒͰ͸ͳ͍͕ʜ ຊ౰͔ʁ ʣ
  18. ·ͱΊ w ݻ͘ॊೈͰॻ͖΍͍͢ݴޠͱͯ͠ਐԽɺ ࠓޙ΋8FCܥͷϝδϟʔͨΓ͏Δ w ʮ৽ൃ໌ػೳʯ͸ແ͍ɻڭՊॻΈ͍ͨͳ001Ͱॻ͚͹ྑ͍ w ෆ଍͸ଞͷݴޠ౳ͷྗΛआΓΕ͹ྑ͍ͱɺ օ͕ཧղͯ͠ੜ࢈ੑΛ࠶ධՁ͞Εͭͭ͋Δ ཉ໨

    ئ๬ w 1)1ͷʮෛ࠴ʯ͸ϨΨγʔίʔυͱʮେख'8৴ไओٛʯ ΑΓྑ͍ίʔυɾઃܭ͕Ͱ͖Δͱཧղ͠վળ͚ͭͮ͠Δਓ͕ඞཁ
  19. ҎԼ͸LTதʹɺಉ࣌ʹπΠʔτͯ͠ ͍ͨςΩετͰ͢

  20. ۙ೥ʢ1)1ʣͷΦγϟϨจ๏Ұؾʹݟ͍ͨͳΒͪ͜Β େମΩϟονΞοϓͰ͖ΔΑʂ .PEFSO1)1c%JNJUSJPT-ZUSBT IUUQTEOMZUSBTDPNCMPHNPEFSOQIQ

  21. ࣍ੈ୅ʢ1)1ʣͷ࿩Έ͍ͨͳΒͪ͜Β ·͋ɺ༧ఆ͸ະఆ͚ͩͲͶʂ 8IBUTOFXJO1)1TUJUDIFSJP IUUQTTUJUDIFSJPCMPHOFXJOQIQ

  22. ࠓޙདྷΔ͔΋͠Εͳ͍1)1ػೳ͸1)1SGDͰΈΕΔΑ དྷͯ΄͍͠ʂͱ͍͏ػೳ͕7PUF࢝·ΔͱفΔؾ࣋ͪʹͳΔΑ 1)1SGD IUUQTXJLJQIQOFUSGD

  23. ʮ೔ຊͷίϛϡχςΟͬͯͲ͜ʁʯͱ͍͏ͱ࠷ۙͩͱҎԼͱ͔͋ΔΑ 1)1Ϣʔβʔζ ೔ຊޠ  IUUQTXXXNTOHJOGPBSDIJWFTQIQVTFSTKBPOTMBDLQIQ !1)1FS3PPN IUUQTUXJUUFSDPN1)1FS3PPN

  24. ݁ہ"QQ4FSWFS͕ͳ͍1)1΋࠷ۙ͸৭ʑ͋ΔΑ 3PBE3VOOFSͱ͔ɺ"NQͱ͔ɺ4XPPMFܥͳͲ IUUQTSPBESVOOFSEFW IUUQTBNQIQPSHIUUQTFSWFS ʢ4XPPMF͸෼྾தͳͷͰάάͬͯ͆ʣ

  25. ϑϦʔμϜੈք΋ଞΛਅࣅͯ͠ʮඪ४ɾ׳शԽʯ͠Α͏ͱ͍ͯ͠ΔΑ ·͋Ͱ΋ެࣜͰ͸ͳ͍͠ɺօࣗ༝ʹ޷͖ͳ΋ͷΛ͔͍ͭͬͯΔΑ 1)14UBOEBSET3FDPNNFOEBUJPOT1)1'*( IUUQTXXXQIQpHPSHQTS ʢݱ࣮తʹ͸ʮ4ZNGPOZϥΠϒϥϦʯ͕ن໿ʹ͍ۙؾ͕͢ΔΑ͆-BSBWFM΋ͦ͏ͩ ͠Ͷʣ

  26. 1)1ͷ੩తղੳ͸ิ׬ɺΤϥʔࢦఠ΍ࣗಈमਖ਼৭ʑ͋ΔΑ ྫ͑͹ҎԼ΍ଞ༷ʑ͋ΔΑ 'JOE#VHT8JUIPVU8SJUJOH5FTUTc1)14UBOIUUQTQIQTUBOPSH 1TBMNBTUBUJDBOBMZTJTUPPMGPS1)1IUUQTQTBMNEFW 1IQ4UPSNIUUQTXXXKFUCSBJOTDPNKBKQQIQTUPSN 1)1$PEJOH4UBOEBSET'JYFSIUUQTDTTZNGPOZDPN

  27. ࠷ۙͷ'8ʁ-BSBWFMڧ͍ΑͶɺ࠷ॳ͸ָ͔ͩΒͶɺͰ΋ଞ΋͋ΔΑʂ 4MJN'SBNFXPSLIUUQTXXXTMJNGSBNFXPSLDPN 4ZNGPOZIUUQTTZNGPOZDPN ;FOE'SBNFXPSLIUUQTGSBNFXPSL[FOEDPN $BLF1)1IUUQTDBLFQIQPSHKQ

  28. ΈΜͳϕϯν͸޷͖ͩΑͶɺ7FS্͕Δ͝ͱʹ଎͘ͳͬͯΔΑ IUUQTLJOTUBDPNKQCMPHQIQCFODINBSLT ͪͳΈʹ1)1͸ʮ΢ΣϒΞϓϦʯͳΒதʑ଎͍ΑɺOHY@QIQ࢖͍͍ͨ Ͳ͜Ͱʜ ʢҎԼͷϕϯνϚ͸͋ΔҙຯωλͱࢥͬͯΑ͍͕·͋໘ന͍ͷͰ͆ʣ 5FDI&NQPXFS'SBNFXPSL#FODINBSLT IUUQTXXXUFDIFNQPXFSDPNCFODINBSLTTFDUJPOEBUB SIXQIUFTUGPSUVOF

  29. 1)1͸ϝδϟʔ͔ͩΒͶɺ"1.΋৭ʑ͋ΔΑɻ ࡢࠓ͸ӡ༻ΞϓϦͷΦϒβʔόϏϦςΟॏཁ΍Ͷʂ /FX3FMJDIUUQTOFXSFMJDDPNKQ #MBDLpSFJPIUUQTXXXCMBDLpSFJP ʢ%BUB%PH΋͍Δ͚Ͳɺ͋Μ·Γ1)1ͩͱݟͳ͍Ͷʁʣ

  30. ࠷ۙͷ1)1ϥΠϒϥϦΛ΢Υον͢ΔͳΒ͜ͷCPUͱ͔͍͍Α ·͋ࢲ͕ϝϯςͯ͠Δ#PUͳΜ͚ͩͲͶ͆͆ ͍ΖΜͳύοέʔδ͕ੜ·Ε͍ͯΔͳʙͬͯࢥ͏Αʂ !DBMMVTFSGVOD5XJUUFSIUUQTUXJUUFSDPNDBMMVTFSGVOD

  31. ʮϥΠϒϥϦ͕΄͍͠ͳʯͬͯͳͬͨΒେखΛ·ͣݟͯΈΔͱ͍͍Αʂେମ͋Δ Αʂ େख͕͍͍ͷ͸ɺͪΌΜͱ৽͍͠7FSʹ௥ैͯ͘͠ΕΔॴͩͶʜ IUUQTUIFQIQMFBHVFDPN IUUQTTZNGPOZDPN IUUQTBVSBQIQDPN