$30 off During Our Annual Pro Sale. View Details »

PHP Data Structures

PHP Data Structures

Connehito Marché vol.5 〜PHP市〜 の LT 資料です
https://connehito.connpass.com/event/122217/

Takuya Arita

March 20, 2019
Tweet

More Decks by Takuya Arita

Other Decks in Programming

Transcript

  1. Data Structures
    @ariarijp (Takuya Arita / ༗ా ୓࠸)

    View Slide

  2. Data Structures?

    View Slide

  3. Data Structures ʹ͍ͭͯ
    • PHP ϚχϡΞϧ
    • http://php.net/manual/ja/book.ds.php
    • GItHub
    • https://github.com/php-ds/ext-ds
    • ։ൃऀʹΑΔղઆ
    • https://medium.com/@rtheunissen/efficient-data-structures-
    for-php-7-9dda7af674cd

    View Slide

  4. ։ൃऀʹΑΔղઆهࣄͷൈਮ
    PHP has one data structure to rule them all.
    The array is a complex, flexible, master-of-none,
    hybrid data structure, combining the behaviour of
    a list and a linked map. But we use it for everything,
    because PHP is pragmatic: “dealing with things
    sensibly and realistically in a way that is based on
    practical rather than theoretical considerations”.
    An array gets the job done. Unfortunately, with
    flexibility comes complexity.

    View Slide

  5. ಛ௃
    • Α͋͘Δσʔλߏ଄Λఏڙ
    • ༻్ʹ͋Θͤͯద੾ʹσʔλߏ଄Λબ୒Ͱ͖
    Ε͹ɺύϑΥʔϚϯε޲্Λૂ͑Δ
    • Polyfill ΋ఏڙ͞Ε͍ͯΔ

    View Slide

  6. αϙʔτ͍ͯ͠Δσʔλߏ଄
    • Vector
    • Deque
    • Map
    • Set
    • Stack
    • Queue
    • PriorityQueue
    • Pair

    View Slide

  7. ·ͱΊ
    • ແཧʹ࢖͏͜ͱ΋ແ͍Ͱ͕͢ɺ஌͓ͬͯ͘ͱ
    ॿ͔Δ͜ͱ͕͋Δ͔΋͠Ε·ͤΜ
    • ͔͠͠ɺ͜Εͬͯ PHP ʮΒ͍͠ʯͷ͔ʁ
    • ·ͩ·ͩ PHP ʹ΋஌Βͳ͍͜ͱ͕͍ͬͺ͍͋
    Γ·͢Ͷʂ

    View Slide

  8. খωλͰ͕ͨ͠
    ʮ஌ͬͯΔʯͷ͓ͦ͢Θ͚Ͱͨ͠

    View Slide