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
360
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
540
date()とかtime()の関数よりDateTimeクラス使った方が良さそう的な話
takahashiyuya
0
19
Laravelのヘルパー
takahashiyuya
1
2.7k
PSR が分かってきた
takahashiyuya
0
590
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.7k
Practical Orchestrator
shlominoach
192
12k
Marketing to machines
jonoalderson
1
6k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Navigating Weather and Climate Data
rabernat
0
580
Technical Leadership for Architectural Decision Making
baasie
3
630
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
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 🇮🇱 ·͓ͩΔͰʙ