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
Node-RED × MCP 勉強会 vol.1
1ftseabass
PRO
0
140
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
2
240
製造業からパッケージ製品まで、あらゆる領域をカバー!生成AIを利用したテストシナリオ生成 / 20250627 Suguru Ishii
shift_evolve
PRO
1
130
~宇宙最速~2025年AWS Summit レポート
satodesu
1
1.8k
“社内”だけで完結していた私が、AWS Community Builder になるまで
nagisa53
1
370
実践! AIエージェント導入記
1mono2prod
0
160
Кто отправит outbox? Валентин Удальцов, автор канала Пых
lamodatech
0
330
TechLION vol.41~MySQLユーザ会のほうから来ました / techlion41_mysql
sakaik
0
180
rubygem開発で鍛える設計力
joker1007
2
190
UIテスト自動化サポート- Testbed for XCUIAutomation practice
notoroid
0
130
「Chatwork」の認証基盤の移行とログ活用によるプロダクト改善
kubell_hr
1
150
Абьюзим random_bytes(). Фёдор Кулаков, разработчик Lamoda Tech
lamodatech
0
330
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
69
11k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
How to Ace a Technical Interview
jacobian
277
23k
Writing Fast Ruby
sferik
628
61k
Documentation Writing (for coders)
carmenintech
71
4.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
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 ྻͷཁૉͷܕΛറΓ͍ͨͱ͖