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 での追加機能のおさらいとバージョンアップへの誘い / Re-int...
Search
Yoshihide TANIGUCHI
March 16, 2017
Programming
0
88
PHP 5.4 ~ 5.6 での追加機能のおさらいとバージョンアップへの誘い / Re-introduce PHP5.4~5.6 and invitation for upgrading
社内のテックミーティングの資料(公開 ver)
Yoshihide TANIGUCHI
March 16, 2017
Tweet
Share
More Decks by Yoshihide TANIGUCHI
See All by Yoshihide TANIGUCHI
スタディサプリ/Quipper オンラインミートアップ #1(Webエンジニア) / 新規サービス開発チームの紹介 / Studysapuri online meetup #1
ravelll
0
2.2k
Raspberry Pi と Netatmo と少しの ruby で作る二酸化炭素濃度モニター君
ravelll
0
69
Ruby の静的型チェックの話
ravelll
0
78
Quipperian and VimConf2019
ravelll
1
5.5k
さくらのフロントエンド さくらの Vue.js // vue.js in SAKURA
ravelll
3
4.2k
PHP7.2で始める型宣言 // Type declaration with PHP 7.2
ravelll
0
280
ISUCONのすゝめ // Shall we ISUCON ?
ravelll
0
110
オブジェクト指向設計とデザインパターンの基礎 / Basics of object oriented design and design pattern
ravelll
0
690
1人から始める大規模Webアプリケーションの言語バージョンアップ / Upgrade PHP in a large application
ravelll
0
130
Other Decks in Programming
See All in Programming
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
24
12k
JavaでLチカしたい! / JJUG CCC 2024 Fall LT
nhayato
0
110
macOS でできる リアルタイム動画像処理
biacco42
9
2.3k
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
180
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
590
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
420
みんなでプロポーザルを書いてみた
yuriko1211
0
190
Java ジェネリクス入門 2024
nagise
0
690
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
160
GCCのプラグインを作る / I Made a GCC Plugin
shouth
1
160
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
450
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.7k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
202
24k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
What's in a price? How to price your products and services
michaelherold
243
12k
Building Your Own Lightsaber
phodgson
102
6.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.8k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
How STYLIGHT went responsive
nonsquared
95
5.2k
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