Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP 5.4 ~ 5.6 での追加機能のおさらいとバージョンアップへの誘い / php54 ...
Search
Yoshihide Taniguchi
May 16, 2017
Programming
1
2.4k
PHP 5.4 ~ 5.6 での追加機能のおさらいとバージョンアップへの誘い / php54 to 56 and version up
社内のテックミーティングの資料(公開 ver)です
Yoshihide Taniguchi
May 16, 2017
Tweet
Share
More Decks by Yoshihide Taniguchi
See All by Yoshihide Taniguchi
PHP がフロントエンドエンジニアになってみた // from PHPer to Frontend
gs3
1
330
PHP7.2で始める型宣言
gs3
0
560
ISUCONのすゝめ // OUR ISUCON
gs3
3
1.4k
オブジェクト指向設計とデザインパターンの基礎 / Basics of object oriented design and design pattern
gs3
2
100k
1人から始める大規模Webアプリケーションの言語バージョンアップ / version up PHP in large scale application
gs3
20
5.1k
あの日見たバグを僕達はまだ公式ドキュメントで見れない / The bug we saw that day
gs3
1
1.5k
ペパボを支える大統一CI基盤と人々
gs3
2
4.1k
PHP 5.3.x のアプリを PHP 7.0.x で動かすためにした n 個のこと
gs3
1
1.6k
今までやってきたこと これからやりたいこと
gs3
0
2.3k
Other Decks in Programming
See All in Programming
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
350
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
570
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
2
250
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
450
ReadMoreTextView
fornewid
1
470
Is Xcode slowly dying out in 2025?
uetyo
1
190
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
310
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
230
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
190
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
290
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
46
30k
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
140
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Practical Orchestrator
shlominoach
188
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Unsuck your backbone
ammeep
671
58k
It's Worth the Effort
3n
185
28k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
16
940
RailsConf 2023
tenderlove
30
1.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
4 Signs Your Business is Dying
shpigford
184
22k
Transcript
d1)1όʔδϣϯ্͕Δͱศར͡ΌΜd &$ج൫୩ޱHVTTBO &$5FDI.5( 1)1dͰͷ Ճػೳͷ͓͞Β͍ͱ όʔδϣϯΞοϓͷ༠͍
എܠ wϩʔϧ"ͷ1)1͕Y͔ΒʹͳΓ·ͨ͠ w1)1dͰՃ͞ΕͨػೳΛ͍ͬͯ·͔͢ʁ w͋Μ·ΓΓ·ͤΜͰͨ͠ wطଘͷίʔυ͔Β৽ػೳֶ·ͤΜ wࣗൃతͳֶश͕ඞཁͰ͢ ˞ ॾ͔Βɺࠓ͙͢͏ͱ͕͋Γ·͢
1)1Ͱͳ͘ΛબΜͩཧ༝ʹ͍ͭͯˣΛࢀর wIUUQTTQFBLFSEFDLDPNHTBGBMTFSJKJBOUBCBHVXPQVEB IBNBEBHPOHTIJEPLJZVNFOUPEFKJBOSFOBJ
ࠓճ͓͍ͨ͜͠ͱ w1)1͔Β·ͰʹՃ͞Εͨػೳʹ͍ͭͯ wಠஅͱภݟͰൈਮ͠·ͨ͠ w1)1dͰඇਪʹͳΔɾແ͘ͳΔػೳʹ͍ͭͯ w͜Ε͔ΒΘͳ͍ɺফͤͦ͏ͳΒফ͢ wόʔδϣϯΞοϓͯ͠Έ·ͤΜ͔ʁͱ͍͏͓༠͍
✂͔͜͜Βػೳհ✂
<>ʢdʣ wBSSBZ Λ<>Ͱॻ͚ΔΑ͏ʹͳͬͨ $men = [‘Jon’, ‘Bon’, ‘Jovi’]; //
$men = array(‘Jon’, ‘Bon’, ‘Jovi’); ͱՁ
"SSBZ 4USJOHͷσϦϑΝϨϯεʢdʣ wྻɺจࣈྻΛఴࣈͰࢀরͰ͖ΔΑ͏ʹͳͬͨ print [1, 2, 3, 4][0]; // =>
1 print ‘colorme’[4]; // => ‘r’
ؔͷฦΓͷఴࣈࢀর d wؔʢϝιουʣͷฦΓΛఴ͑ࣈͰࢀরͰ͖ΔΑ͏ʹͳͬͨ function simple_array() { return [1, 2, 3];
} print simple_array()[1]; // => 2
BSSBZ@DPMVNO wd wଟ࣍ݩྻʹ͋Δ ಛఆͷΩʔͷΛऔಘ͢Δؔ $array = [ [ 'id'
=> 101, 'name' => 'Jim', 'position' => 'guitar', ], [ 'id' => 102, 'name' => 'Corey', 'position' => 'vocals', ] ]; print_r(array_column($array, 'name')); // Array // ( // [0] => Jim // [1] => Corey // )
FNQUZ ʹ͕ࣜͤΔΑ͏ʹ d w͋ͷFNQUZ ʹม͚ͩͰͳ͕ࣜͤ͘ΔΑ͏ʹͳͬͨ if (empty(current_gmo_point())) {
// . . . }
DPOTUͰྻͷఆԽ d wDPOTUΩʔϫʔυͰྻΛఆͱͯ͠એݴͰ͖ΔΑ͏ʹͳͬͨ const ARR = [1, 2, 3]; print_r(ARR);
// Array // ( // [0] => 1 // [1] => 2 // [2] => 3 // )
ԋࢉࢠ d wՄมҾΛԋࢉࢠͰ දݱͰ͖ΔΑ͏ʹͳͬͨ w͞ΒGVOD@HFU@BSHT function puts_nums(...$nums) {
print_r($nums); } puts_nums(1); puts_nums(1, 2); puts_nums(1, 2, 3); // Array // ( // [0] => 1 // ) // Array // ( // [0] => 1 // [1] => 2 // ) // Array // ( // [0] => 1 // [1] => 2 // [2] => 3 // )
ྦྷԋࢉࢠ d w✽✽Ͱྦྷԋࢉ͕Ͱ͖ΔΑ͏ʹͳͬͨ wॖೖԋࢉࢠͷ✽✽Ճ $num = 3 ** 2; $num
**= 2; print $num; // => 81
pOBMMZΩʔϫʔυ d wUSZDBUDIϒϩοΫʹpOBMMZΩʔϫʔυ͕Ճ͞Εͨ try { throw new Exception('5'); } catch
(Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { echo '͍'; } // => Caught exception: 5 // ͍
։ൃ༻$-*8FCαʔό d w8FCαʔό͕$-*Ϟʔυͷ1)1ʹΈࠐ·Εͨ wϧʔτ63-ʹΞΫηε͢ΔͱJOEFY QIQcIUNM Λฦͯ͘͠ΕΔ $ echo ‘Hello, PHP!’
> index.html $ php -S localhost:7000 -t . $ curl localhost:7000 Hello, PHP!
USBJU w୯Ұܧঝͳ1)1Ͱ ৼΔ͍Λڞ༗͢ΔΈ wྫʣը૾ΛΞοϓϩʔυͰ͖Δ ৼΔ͍Λڞ༗͢Δ trait UploadImage { function upload($imagePath)
{ //... } } class ProductController { use UploadImage; // ... } class ShopController { use UploadImage; // ... }
։ൃ༻$-*8FCαʔό d w8FCαʔό͕$-*Ϟʔυͷ1)1ʹΈࠐ·Εͨ wϧʔτ63-ʹΞΫηε͢ΔͱJOEFY QIQcIUNM Λฦͯ͘͠ΕΔ $ echo ‘Hello, PHP!’
> index.html $ php -S localhost:7000 -t . $ curl localhost:7000 Hello, PHP!
େ͖͍ϑΝΠϧͷΞοϓϩʔυ d w(#Ҏ্ͷϑΝΠϧΞοϓϩʔυͰ͖ΔΑ͏ʹͳͬͨ
1)1Ͱ͑ͳ͘ͳΔػೳ ൈਮ wNZTRM@ ؔ wFSFH ؔ wDBMM@VTFS@NFUIPE DBMM@VTFS@NFUIPE@BSSBZ wQIQJOJͷBTQ@UBHT
wNFNDBDIFQFDMFYUFOTJPO wNFNDBDIF`E`FYUFOTJPO1)1YʹରԠ
1)1dͰEFQSFDBUFͳػೳ ൈਮ w w $MBTT/BNF ͳίϯετϥΫλ w ඇTUBUJDϝιουͷTUBUJDͳݺͼग़͠ w
w FYUNDSZQUϞδϡʔϧ w 3'$ͷஈ֊ w @@BVUPMPBE w DSFBUF@GVODUJPO w FBDI w ୈҾͷͳ͍QBSTF@TUS
w ࠓճհ͠ͳ͔ͬͨ w ՃͷؔɺΫϥεɺϝιου w ඇਪɾআͱͳͬͨػೳɾϞδϡʔϧ w ʹ͍ͭͯ1)1ϚχϡΞϧͷʹ͋Γ·͢ w IUUQQIQOFUNBOVBMKBBQQFOEJDFTQIQ
✂͜͜·Ͱػೳհ✂
όʔδϣϯΞοϓͯ͠Έ·ͤΜ͔ʁ wΔͱීஈͷ։ൃͰಘΒΕͳ͍ݟ͕ಘΒΕ·͢ wࠓͳΒϩʔϧ"Ͱͬͨͱ͖ͷϩάΛࢀߟॻʹͰ͖·͢ʂ w͔͠ϩʔϧ"ΑΓίʔυྔଟ͍ϩʔϧແ͍ʂ wόʔδϣϯΞοϓͷλεΫ͕߱ͬͯ͘Δ͜ͱແ͍ wΔؾ͋Δਓ͕֮ޛܾΊͯ࣌ؒऔΓʹߦ͔͘͠ͳ͍ wΔͳΒશྗͰαϙʔτ͠·͢ʂʂʂʂ̍̍
ͯ͢ͷґଘؔʹ͍ͭͯ࠷৽ͷόʔδϣϯʹै͢Δʹෆஅ ͷྗ͕ඞཁ͕ͩɺී௨ɺͦΕΛߦ͏͚ͩͷϝϦοτ͕͋Δɻ ΞοϓάϨʔυʹΑͬͯɺ͠͠ੑೳͷ্όάϑΟοΫε ͕ಘΒΕΔ͠ɺͱ͖ʹக໋తͳηΩϡϦςΟͷύον͕ͯΒ ΕΔɻͦΕ͚ͩΛͯʹґଘؔͷΞοϓάϨʔυΛߦ͏͖ Ͱͳ͍͕ɺҰൠʹɺΞοϓάϨʔυྑ͍͜ͱͰ͋Δɻ ΫϦεɾόʔνϟϧʮϨΨγʔιϑτΣΞվળΨΠυʯᠳӭࣾ
ࢀߟɿ1)1ͷαϙʔτόʔδϣϯ IUUQQIQOFUTVQQPSUFEWFSTJPOTQIQΑΓ ηΩϡϦςΟαϙʔτΕͨͷ͕લ ʂ ͍ͬͺ͍ηΩϡϦςΟαϙʔτ
όʔδϣϯΞοϓͷԸܙ wύϑΥʔϚϯεͷ্Ҏ֎ʹɺجຊతʹ͍͍͜ͱͣ͘Ί wηΩϡϦςΟϦεΫ͕Լ͕Δ w։ൃͷॊೈੑɾݎ࿚ੑ্͕͕Δɾ্͛͘͢ͳΔ wʢ࠷৽ͷʣػೳ͕૿͑Δ wͦΕΛલఏͱͨ͠ศརͳϥΠϒϥϦ͕͑Δ wʹղܾͷબࢶ͕૿͑Δ wࣾ֎ͷใʹΞλον͘͢͠ͳΔɾՌΛࣾ֎ʹൃද͘͢͠ͳΔ wͳͲͳͲ
·ͱΊ w1)1dͰՃ͞ΕͨػೳΛհ͠·ͨ͠ w1)1dͰඇਪɾআͱͳͬͨػೳΛհ͠·ͨ͠ w1)1ͷόʔδϣϯΞοϓʹ༠͍·ͨ͠
ࢀߟ wQIQϚχϡΞϧɿ wIUUQQIQOFUNBOVBMKBBQQFOEJDFTQIQ wQIQSGD wIUUQTXJLJQIQOFUSGD