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
...意外に便利だった!!
Search
chiroruxx
October 30, 2019
Technology
0
170
...意外に便利だった!!
2019/10/30 PHP勉強会@東京で話したスライドです。
chiroruxx
October 30, 2019
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
PHPはいつから死んでいるかの調査
chiroruxx
1
400
元phperから見たGoの良いところ
chiroruxx
0
19
Go Connectへの想い
chiroruxx
0
140
GraphQLに入門してみた
chiroruxx
2
200
ドキュメンテーションコメント再入門
chiroruxx
0
88
我流カンファレンス楽しみ術
chiroruxx
0
58
最初の一歩を踏み出す言葉
chiroruxx
4
1.1k
PhpStormをIDEとして使う
chiroruxx
0
58
Goを始めて感じたPHPの魅力
chiroruxx
1
65
Other Decks in Technology
See All in Technology
Grafana x PagerDuty Better Together
jacopen
0
100
アクセシビリティを考慮したUI/CSSフレームワーク・ライブラリ選定
yajihum
2
1k
[新卒向け研修資料] テスト文字列に「うんこ」と入れるな(2024年版)
infiniteloop_inc
4
16k
複雑な構成要素を持つUIとの向き合い方 〜新・支出グラフでの実例〜 / B43 TECH TALK
nakamuuu
0
140
Azure犬駆動開発の記録/GlobalAzureFukuoka2024_20240420
nina01
1
220
KubeCon EU 2024 Recap “Kubernetes Policy Time Machine: Where to Next?”
ryysud
0
220
サーバー間 GraphQL と webmock-graphql の話 / server-to-server graphql and webmock-graphql
qsona
2
190
Além do else! Categorizando Pokemóns com Pattern Matching no JavaScript
wmsbill
0
640
On Your Data を超えていく!
hirotomotaguchi
2
690
20240418_Google ColabにLLMが搭載されたようなのでPython x データ分析の勉強方法を考えてみる
doradora09
0
140
Vertex AI を中心に 生成AIのアップデートを共有します
kaz1437
0
310
Cloud Native Java with Spring Boot (CNCF Aarhus, April 2024)
thomasvitale
1
180
Featured
See All Featured
How GitHub (no longer) Works
holman
304
140k
[RailsConf 2023] Rails as a piece of cake
palkan
23
4k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Raft: Consensus for Rubyists
vanstee
132
6.3k
Scaling GitHub
holman
457
140k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
227
16k
Web development in the modern age
philhawksworth
202
10k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
A Tale of Four Properties
chriscoyier
151
22k
Typedesign – Prime Four
hannesfritz
36
2.1k
Into the Great Unknown - MozCon
thekraken
10
1k
Transcript
ҙ֎ʹศརͩͬͨ 2019/10/30 PHPษڧձ@౦ژ લా ਓ
ࣗݾհ w લాਓ w !DIJSPSVYYYY w 3PYY
w εϙϯαʔืूதͰ͢ʂʂ
ҙ֎ʹศརͩͬͨ
ʮʯҙ֎ʹศརͩͬͨ
1)1ʹ͓͚Δʮʯ ͭ͋Δ
ՄมݸҾؔ function printArgs(...$inputs) { echo $inputs[0]; // apple echo $inputs[1];
// banana echo $inputs[2]; // chocolate } printArgs('apple', 'banana', 'chocolate');
ҾͷΞϯύοΫ function printArgs($a, $b, $c) { // (ུ) } $args
= ['apple', 'banana', 'chocolate']; printArgs(...$args);
͍͕ͬͯͨʜ w ػೳ͕ଘࡏ͢Δ͜ͱͬͯͨ w Ͱ࣮ࡍશવͬͯͳ͔ͬͨ w ΠϚΠν͍Ͳ͜Ζ͕Θ͔Βͳ͔ͬͨ ࠷ۙɺศརͳ͍ํΛݟ͚ͭͨ
ྫ w ࣗͰఆٛͨ͠4UBUVTΫϥε͕͋Δ w 4UBUVTΛෳѻ͏Ϋϥε͕΄͍͠ w ྻΛϥοϓͨ͠Ϋϥε w ཁ݅ҎԼ w
ҙͷͷ4UBUVTΠϯελϯεΛཁૉʹ࣋ͭ w 4UBUVTΠϯελϯεҎ֎Λཁૉʹ͍͚࣋ͬͯͳ͍ w Ωʔ࿈൪ͷΈʹ͢Δ ࿈ྻʹ͠ͳ͍
·ͣී௨ʹ࣮͠·͢
ී௨ͷ࣮ class StatusCollection { private $items; public function __construct(array $items)
{ $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection($items);
ී௨ͷ࣮ class StatusCollection { private $items; public function __construct(array $items)
{ foreach ($items as $item) { if (!$item instanceof Status) { throw new InvalidArgumentException(); } } $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection($items);
ී௨ͷ࣮ class StatusCollection { private $items; public function __construct(array $items)
{ foreach ($items as $item) { if (!$item instanceof Status) { throw new InvalidArgumentException(); } } $this->items = array_values($items); } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection($items);
Λ͍͖ͬͯ·͢ʂ
Λ࣮ͬͨ class StatusCollection { private $items; public function __construct(...$items) {
foreach ($items as $item) { if (!$item instanceof Status) { throw new InvalidArgumentException(); } } $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection(...$items);
Λ࣮ͬͨ class StatusCollection { private $items; public function __construct(Status ...$items)
{ $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection(...$items);
ศརʂʂ
·ͱΊ w ʮʯΛ͏ͱҎԼͷέʔεͰϥΫʹͳΔ w ྻͷΩʔʹ͍ͭͯߟ͑ͨ͘ͳ͍ͱ͖ w ྻͷཁૉͷܕΛറΓ͍ͨͱ͖