Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
5分で「へぇ〜」がひとつ増える、PHPの”気になる”関数の話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
たきゃはし
November 11, 2025
350
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
5分で「へぇ〜」がひとつ増える、PHPの”気になる”関数の話
たきゃはし
November 11, 2025
More Decks by たきゃはし
See All by たきゃはし
AI時代のWebセキュリティリスク_レビュワーを救いたい.pdf
takahashiyuya
0
510
date()とかtime()の関数よりDateTimeクラス使った方が良さそう的な話
takahashiyuya
0
18
Laravelのヘルパー
takahashiyuya
1
2.7k
PSR が分かってきた
takahashiyuya
0
590
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
Raft: Consensus for Rubyists
vanstee
142
7.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
GitHub's CSS Performance
jonrohan
1033
470k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
270
Optimising Largest Contentful Paint
csswizardry
37
4k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
700
A designer walks into a library…
pauljervisheath
211
25k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Being A Developer After 40
akosma
92
590k
Transcript
̑Ͱʮ͐ʙʯ͕ ͻͱͭ૿͑Δɺ̥̝̥ ͷ"ؾʹͳΔؔ"ͷ ͖ͨΌ͠ @takahashiyuya - PHPΧϯϑΝϨϯεԬ2025
ɹɹಈػɿPHPͷ͕͍ͨ͠ ඪɿ̍͐ʙҎ্ ɹɹɹɹൃදɿΏΔָ͘͠ΜͰ΄͍͠
ɹɹ͖ͨΌ͠ @takahashiyuya • גࣜձࣾϏοτϑΥϨετʢ݄̓ೖࣾʣ • VAddy ςΫχΧϧαϙʔτΤϯδχΞ • ͖ͳԬͷϥʔϝϯʮ໙զΨ খ܊ຊళʯ
͍͖ͳΓຊͷओ օ༷ɺഥखͰ͓ܴ͍͑ͩ͘͞
date_sun_info()
ͬͯΔ͚ͲɺΒͳ͍ɻ ͦΜͳؔʢॾઆ͋Γʣ
͐ʙ͍ͭͰʹ ͬͯΔ ʹͳ͍ͬͯͨͩͭ͘Γ
͜ͷؔΛޠΔલʹ…
🌅date_sunrise() 🌆date_sunset()
date_sunrise() ɾ date_sunset() • ͷग़ɾͷೖΓͷ࣌ࠁ͕औಘͰ͖Δɻ
͜ΕͰΑ͘ͳ͍ʁ
Α͘ͳ͍
ؔఆٛ date_sunrise( int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, ?float $latitude
= null, ?float $longitude = null, ?float $zenith = null, ?float $utcOffset = null ): string|int|float|false
ࣈΑ͘ͳ͍ͱ͜Ζ date_sunrise( int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, ?float $latitude
= null, ?float $longitude = null, ?float $zenith = null, ?float $utcOffset = null ): string|int|float|false
΄ͱΜͲΑ͘ͳ͍
Α͘ͳ͔ͬͨϙΠϯτ • ҾͰΓͷܕ͕มΘΔ • λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ • Ңܦ͕লུͰ͖Δʢʁʣ
ҾͰΓͷܕ͕มΘΔ • ୈೋҾ $returnFormat • औಘ͢Δ࣌ࠁͷϑΥʔϚοτม͑Δ • ΓΛ string |
fl oat | int ͰͦΕͧΕࢦఆͰ͖Δ • ·͔͞ͷୈೋҾ
λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ୈҾ $utcOffset • ෦తʹઃఆͨ͠λΠϜκʔϯͱؔͳ͍ • σϑΥϧτ͕UTCج४(+0) • ͭ·ΓੈքதͰࢦఆඞਢͳୈҾ͕ര
🆕
ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ • $zenith • `ଠཅͷத৺ͱɺٿͷද໘͔Βͷਨઢͷؒʹͳ֯͢Ͱ͢ɻ` • ઐੑ͕ߴ͍ʹؔΘΒͣखೖྗ • ʮαΠτʹΑ͕ͬͯ࣌ؒҧ͏ʯͱ͍͏ࠞཚ͕ੈքதͰى͖ͨ
Ңܦ͕লུͰ͖Δʢʁʣ • Ͳ͔͜ͷͷग़ɾͷೖΓΛΓ͍ͨͷͰʁ • লུ͢ΔͱɺσϑΥϧτͷҢܦͱ͍͏ṖͷͰॲཧ͞ΕΔ • Ṗͷɿ31.7667, 35.2333
❓PHPΫΠζ❓ σϑΥϧτͷҢܦͲ͜ʁ Ṗͷɿ31.7667, 35.2333
None
ਖ਼ղ ΠεϥΤϧ🇮🇱
ͳΜͰ 🇮🇱ʁʁʁ
PHPΛ ։ൃ Zeev͞ΜɹAndi͞Μ ͷ ݩ
·ͨ Zend … Zeev + Andi ͓ೋਓͷ໊લ͕༝དྷͰ͢
༨ஊσϑΥϧτҢܦ
Α͘ͳ͔ͬͨϙΠϯτ • ҾͰΓͷܕ͕มΘΔ • λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ • Ңܦ͕লུͰ͖Δʢʁʣ
ղܾ͍ͨ͠
Ͳ͏ͬͯʁʁ
ͪΖΜؔͰ👍
date_sun_info()
ੜ·ΕมΘͬͨؔఆٛ date_sun_info( int $timestamp, float $latitude, float $longitude ): array
Γ array shape type array(9) { ["sunrise"] => ͷग़ (ఱ֯
= 90°50′) ["sunset"] => ͷೖΓ (ఱ֯ = 90°35′) ["transit"] => ଠཅ͕࠷ߴ͘ͳΔ࣌ࠁʢೆதʣ ["civil_twilight_begin"] => ໌͚ʢࢢຽബ໌ͷ։࢝, ఱ֯ = 96°ʣ ["civil_twilight_end"] => ༦Εʢࢢຽബ໌ͷऴྃ, ఱ֯ = 96°ʣ ["nautical_twilight_begin"] => ߤւബ໌ͷ։࢝ (ఱ֯ = 102°) ["nautical_twilight_end"] => ߤւബ໌ͷऴྃ (ఱ֯ = 102°) ["astronomical_twilight_begin"] => ఱจബ໌ͷ։࢝ (ఱ֯ = 108°) ["astronomical_twilight_end"] => ఱจബ໌ͷऴྃ (ఱ֯ = 108°) }
Α͘ͳ͔ͬͨϙΠϯτ • ҾͰΓͷܕ͕มΘΔ • λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ • Ңܦ͕লུͰ͖Δʢʁʣ
ੜ·ΕมΘͬͨؔఆٛ date_sun_info( int $timestamp, float $latitude, float $longitude ): array
Α͘ͳ͔ͬͨϙΠϯτ • ✔ ҾͰΓͷܕ͕มΘΔ • λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ • Ңܦ͕লུͰ͖Δʢʁʣ
ੜ·ΕมΘͬͨؔఆٛ date_sun_info( int $timestamp, float $latitude, float $longitude ): array
Α͘ͳ͔ͬͨϙΠϯτ • ✔ ҾͰΓͷܕ͕มΘΔ • ✔ λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ •
Ңܦ͕লུͰ͖Δʢʁʣ
Γ array shape type array(9) { ["sunrise"] => ͷग़ (ఱ֯
= 90°50′) ["sunset"] => ͷೖΓ (ఱ֯ = 90°35′) ["transit"] => ଠཅ͕࠷ߴ͘ͳΔ࣌ࠁʢೆதʣ ["civil_twilight_begin"] => ໌͚ʢࢢຽബ໌ͷ։࢝, ఱ֯ = 96°ʣ ["civil_twilight_end"] => ༦Εʢࢢຽബ໌ͷऴྃ, ఱ֯ = 96°ʣ ["nautical_twilight_begin"] => ߤւബ໌ͷ։࢝ (ఱ֯ = 102°) ["nautical_twilight_end"] => ߤւബ໌ͷऴྃ (ఱ֯ = 102°) ["astronomical_twilight_begin"] => ఱจബ໌ͷ։࢝ (ఱ֯ = 108°) ["astronomical_twilight_end"] => ఱจബ໌ͷऴྃ (ఱ֯ = 108°) }
Α͘ͳ͔ͬͨϙΠϯτ • ✔ ҾͰΓͷܕ͕มΘΔ • ✔ λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ✔ ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ
• Ңܦ͕লུͰ͖Δʢʁʣ
ੜ·ΕมΘͬͨؔఆٛ date_sun_info( int $timestamp, float $latitude, float $longitude ): array
Α͘ͳ͔ͬͨϙΠϯτ • ✔ ҾͰΓͷܕ͕มΘΔ • ✔ λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ✔ ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ
• ✔ Ңܦ͕লུͰ͖Δʢʁʣ
✔ Α͘ͳ͔ͬͨϙΠϯτ • ✔ ҾͰΓͷܕ͕มΘΔ • ✔ λΠϜκʔϯ͕ಠཱ͍ͯ͠Δ • ✔
ఱ֯Λखೖྗ͢Δඞཁ͕͋Δ • ✔ Ңܦ͕লུͰ͖Δʢʁʣ
✔ શղܾ
PHP5.1.0ͰϦϦʔε🎉
ΊͰͨ͠ΊͰͨ͠
…
❓PHPΫΠζ❓ ϦϦʔεޙɺdate_sun_info()Λ ऻͬͨग़དྷࣄͱԿʁ
None
Latitude and longitude are backwards in date-sun-info
date_sun_info() ͷ Ңͱܦ͕ٯͰ͢
͑ Ңͱܦ͕ٯʹ ॲཧ͞Ε͍ͯͨ💥
ͦΜͳ͜ͱ͋ΔΜͩͳ͊
date_sun_info() Λ̑લΑΓ ͬͯΔʹͳΕͨͰ͠ΐ͏͔ʁ
ͱΓ͋͑ͣಈ͔ͤΔ ͦͷͨΊͷศརͳ͕ؔ͋Δ ࣗʹͱͬͯɺͦΕ͕PHPΒ͠͞
͋Γ͕ͱ͏ PHPΧϯϑΝϨϯεԬ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ ʮ͐ʙʯͷ͚ͩഥखΡʙʙʙ👏
ࢀরɿhttps://github.com/php/php-src/blob/php-8.4.14/ext/date/php_date.c#L247-L248 🇮🇱 ·͓ͩΔͰʙ