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
210
...意外に便利だった!!
2019/10/30 PHP勉強会@東京で話したスライドです。
chiroruxx
October 30, 2019
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
Go Connectへの想い
chiroruxx
0
170
eBPF with PHPをさわる
chiroruxx
0
120
sl完全に理解したつもり
chiroruxx
0
100
命名をリントする
chiroruxx
1
780
良い命名かを調べるリンターを作った + α
chiroruxx
0
110
GoLandを布教する会
chiroruxx
0
36
PHPはいつから死んでいるかの調査
chiroruxx
3
650
元phperから見たGoの良いところ
chiroruxx
0
93
Go Connectへの想い
chiroruxx
0
480
Other Decks in Technology
See All in Technology
rubygem開発で鍛える設計力
joker1007
2
180
Model Mondays S2E02: Model Context Protocol
nitya
0
210
Microsoft Build 2025 技術/製品動向 for Microsoft Startup Tech Community
torumakabe
2
250
変化する開発、進化する体系時代に適応するソフトウェアエンジニアの知識と考え方(JaSST'25 Kansai)
mizunori
1
190
Observability infrastructure behind the trillion-messages scale Kafka platform
lycorptech_jp
PRO
0
130
AIのAIによるAIのための出力評価と改善
chocoyama
2
540
標準技術と独自システムで作る「つらくない」SaaS アカウント管理 / Effortless SaaS Account Management with Standard Technologies & Custom Systems
yuyatakeyama
3
1.2k
ひとり情シスなCTOがLLMと始めるオペレーション最適化 / CTO's LLM-Powered Ops
yamitzky
0
420
VISITS_AIIoTビジネス共創ラボ登壇資料.pdf
iotcomjpadmin
0
160
Абьюзим random_bytes(). Фёдор Кулаков, разработчик Lamoda Tech
lamodatech
0
320
5min GuardDuty Extended Threat Detection EKS
takakuni
0
110
生成AIで小説を書くためにプロンプトの制約や原則について学ぶ / prompt-engineering-for-ai-fiction
nwiizo
3
710
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
71
4.9k
It's Worth the Effort
3n
185
28k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Typedesign – Prime Four
hannesfritz
42
2.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Optimizing for Happiness
mojombo
379
70k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Scaling GitHub
holman
459
140k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
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 ྻͷཁૉͷܕΛറΓ͍ͨͱ͖