Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

ੜ͖ͯΔ৔ॴ w ϋΠύϑΥʔϚϯεʮҎ֎ʯͷ΢ΣϒόοΫΤϯυ w ྫ8FCTPDLFU΍ϙʔϦϯάɺ$,ɺH31$౳Ҏ֎ w ݱ୅͸ඞཁͳॴ͚ͩڧ͍ݴޠΛ࢖͏ͷ͕ී௨ ʢྫΩϡʔ ϝοηʔδϒϩʔΧʔ͸ผݴޠ΍ϚωʔδυͰʣ w ͪΌΜͱͨ͠ݴޠΛ࢖͍͑ͯΔօ͞ΜͳΒ໰୊ແ͍೉қ౓

Slide 6

Slide 6 text

ʮͳͥJava౳ʹ͠ͳ͍ͷ͔ʁʯ w ʮͷέʔεͰ+BWB΄ͲΊΜͲʜ߽՚ͳඞཁ͕ͳ͍͔Βʯ w ۪௚ͳݴޠͳͷͰɺૉ௚ͳίʔυͳΒσόοά͕͠΍͍͢ ʢ5ISFBEͱ͔$PSPVUJOFͱ͔ͳ͍ͷͰɺελοΫ͕γϯϓϧʣ w ೉ղͳϏϧυπʔϧ੔උ΍ίϯύΠϧ͕ෆཁͰ͋Δ w $PNQPTFS1BDLBHJTU͸.BWFOͱ͔/VHFUͱ͔ΑΓָʂʂʂʂ w ʮ೥લͷίʔυ͕ಈ͘͠ɺιʔε͕ඞͣಡΊΔʯ

Slide 7

Slide 7 text

ਐԽͭͭ͋͠Δܕ w ෳࡶͳઃܭʹ଱͑ΒΕΔ͔ͬ͠Γͱͨ͠ݴޠ࢓༷ɺܕ w ʮ1)1͕͔ͬ͠Γͱͨ͠ݴޠʁʁʁʯ w ܕ΍Ϋϥεɺ&OVN౳վળɺ4QSFBE΍NBUDIࣜදݱྗͷ޲্ w ੩తղੳ͕ڧ͘ޮ͘ݴޠઃܭͱɺͦΕΛऔΓר͘πʔϧ w ͜ͷ͋ͨΓ͸UBETBOͷൃදͰ΍ΔΜ͡Όͳ͍͔φʁʁ

Slide 8

Slide 8 text

ʮͰ΋ΏΔ;ΘܕͰ͠ΐʁʯ 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

Slide 9

Slide 9 text

੩తղੳΛ͔͓ͭ͏ w ੩తղੳπʔϧ࢖͑͹array·ͰͰ͖ΔΜͰ͢Α w ݱ୅ͷ1)1͸ɺ੩తղੳͰೋาࡾาઌʹڧ͘ͳΕΔ

Slide 10

Slide 10 text

ʮಈతʯ͸ٻΊΒΕ͍ͯͳ͍ w new $class($param)໓ΜͰ΄͍͠ ݸਓͷײ૝ w JGจͰݻΊͳ͘ͱ΋؆ܿʹݎ͘ॻ͘͜ͱ͕Ͱ͖Δݱ୅ w 1010Ͱݎ͘ॻ͘ݶΓɺ͔ͬ͠Γͱͨ͠ίʔυ͕ॻ͚Δ w Ҿ͖ଓ͖ڐ͞ΕΔΏΔ;ΘίʔυͱΏΔ;ΘϑϨʔϜϫʔΫ w ͜ͷࠞࡏɾڥքΛͲ͏ཱ྆͢Δ͔͕ݱࡏͷ՝୊ͱࢥ͏ w ੲ͸ ࠓ΋ 1FSM΍3VCZ͕ત·͔͕ͬͨ͠ࠓ͸ҧ͏

Slide 11

Slide 11 text

ڧԽ͞Ε͍ͯΔ΋ͷ w Ҿ͖ଓ͖$PNQPTFS1BDLBHJTUͳͲΤίγεςϜ w &OVNɺ6/*0/ܕͳͲॊೈɾιϦουͳݴޠ΁ͷมԽ͔ͭ ಈతͳ෺ "UUSJCVUF౳ ΋௥Ճʢ+BWB͍ݴޠʹͳΓͭͭ͋Δʣ w NBUDIࣜͱ͔ɺGO ͱ͔ɺTQSFBE΍SFBEPOMZͷ͓͠ΌΕ͞ ʁ w ྺ࢙తܦҢͷ࡟ݮʢ#$౳Λ൐͏Ϩϕϧͷվֵʣ w &'*ʢʮ1)1FSͩͬͯ$ϥΠϒϥϦୟ͖͍ͨΑͳʂʢʁʁʣʯʣ

Slide 12

Slide 12 text

ਐԽ͠ͳ͍Ͱ͋Ζ͏΋ͷ w UISFBEɻωΠςΟϒεϨου͕ඞཁͳέʔε͕ͳ͍ w ʢຊ෺ͷʣ4JOHMFUPOɺϓϩηεΛ·ͨ͛ͳ͍ͷͰ͜ͳͦ͏ ʢ1SFGPSLϞσϧ͸ҡ࣋͞ΕΔͩΖ͏ʣ w ͨͩ͠ɺ$֦ுͰ͸ଘࡏ͠͏Δ͠ɺ͢Ͱʹ͋Δ w ࡢࠓ૿͑ͨɺόΠφϦσʔλͷૢ࡞ w Ͱ͖ͳ͍Θ͚Ͱ͸ͳ͍͕ʜόΠφϦߏ଄ମ΄͍͠Ͷ

Slide 13

Slide 13 text

଍Γͳ͍΋ͷ w جຊతʹ͸ɺ 1SF GPSLͳͷͰʜ ݱ୅Ͱ͸ॏཁͳฒߦɾฒྻॲཧ͕·ͩෆಘҙ w ϥΠϒϥϦ͸͋Δ͕ɺσϑΝΫτ͕ͳ͍ w ʢࠓೖΕͯ೥ϨϕϧͰ௕ੜ͖͢Δ͔͕ෆ໌ʣ w 'JCFS͕ೖͬͨͷͰɺࠓޙվળ͞Ε͍͔ͯ͘΋͠Εͳ͍

Slide 14

Slide 14 text

଍Γͳ͍΋ͷ̎ w ʮIUUQEདྷͯ͘ΕʂίϯςφͰ໘౗ʂʯ "QBDIFQIQ΍QIQGQN w ͋Δʹ͸͋Δ w 4XPPMFɺ"NQɺ3FBDU ࣗݾIUUQE w 3PBE3VOOFS (P1SFGPSL w FUD FUD w ඇ७ਖ਼ͳΒ৭ʑ͋Δ

Slide 15

Slide 15 text

ݴޠʮ֎ʯͷਐԽ w ଞݴޠಉ༷ʹ3FRVFTU3FTQPOTFΦϒδΣΫτ͕ීٴ w 143 EFGBDUPͱ͸ݴ͍ͮΒ͍͕ɺม׵Ͱ͖Δ΋ͷ͕ଟ͍ w 84(*3BDL&YQSFTTతʹ ɺಠࣗ"QQ4FSWFS'8ͷ૬ޓޓ׵ w ϓϩηεͰ/SFRΛ͞͹͘ɾ͚Δɺςετ͠΍͘͢ͳͬͨ w ແ࿦ɺݹ͍1)1ελΠϧͱ͸ܾผ͢Δඞཁ͸͋Δ ྫɿ$_GET, $_SESSION, echo ""ͷഉআ

Slide 16

Slide 16 text

վળ͞ΕͨΤϥʔॲཧ w Τϥʔͱྫ֎ɺฦΓ஋ɺget_hoge_last_error౳͕ ࠞͬͨࠞ͟ಱੈք͸ ֓ͶʜOPUશ෦ ऴΘͬͨ w ྫ֎ػߏͰѻ͑Δ5ISPXBCMFʹ౷߹͞Εͨͭͭ͋Δ w ࠓͰ͸ɺେମ͸ྫ֎ɾΤϥʔΛద੾ʹѻ͑Δ w େن໛όον΍αʔόʔϓϩάϥϜΛॻ͚Δ w ʢ1%0ͷ%#࠶઀ଓपΓ͕΋͏গ͠੔උ͞Εͯ΄͍͠ͳʜʣ

Slide 17

Slide 17 text

ࡢࠓେมͳϙΠϯτ w -54ෆࡏʢϚΠφʔόʔδϣϯ͸ϚΠφʔόʔδϣϯͰ͸ͳ͍ʣ w ΠέͯΔػೳ͸૿͑Δ͕ɺͲΜͲΜͱ#$౳͕ൃੜ͢Δ w ʮͪΌΜͱςετॻ͚͹0,ʯʮͦΕͳʯ w ௥͍͔͚͍ͯ͘ίετ͕ඞཁ &0-·Ͱʙ೥ w ΑΓςελϒϧɺΑΓૄ݁߹ͳઃܭʹ͠ͳ͍ͱӬԕʹ͍ۤ͠ w ʢૉ௚ͳίʔυͳΒͦ͜·ͰखؒͰ͸ͳ͍͕ʜ ຊ౰͔ʁ ʣ

Slide 18

Slide 18 text

·ͱΊ w ݻ͘ॊೈͰॻ͖΍͍͢ݴޠͱͯ͠ਐԽɺ ࠓޙ΋8FCܥͷϝδϟʔͨΓ͏Δ w ʮ৽ൃ໌ػೳʯ͸ແ͍ɻڭՊॻΈ͍ͨͳ001Ͱॻ͚͹ྑ͍ w ෆ଍͸ଞͷݴޠ౳ͷྗΛआΓΕ͹ྑ͍ͱɺ օ͕ཧղͯ͠ੜ࢈ੑΛ࠶ධՁ͞Εͭͭ͋Δ ཉ໨ ئ๬ w 1)1ͷʮෛ࠴ʯ͸ϨΨγʔίʔυͱʮେख'8৴ไओٛʯ ΑΓྑ͍ίʔυɾઃܭ͕Ͱ͖Δͱཧղ͠վળ͚ͭͮ͠Δਓ͕ඞཁ

Slide 19

Slide 19 text

ҎԼ͸LTதʹɺಉ࣌ʹπΠʔτͯ͠ ͍ͨςΩετͰ͢

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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