Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7015085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:36:23+00:00 2026-05-27T22:36:23+00:00

I just thought I would comb through this to find the answer: http://svn.php.net/viewvc/php/php-src/ But

  • 0

I just thought I would comb through this to find the answer:
http://svn.php.net/viewvc/php/php-src/

But I couldn’t find it. In C++ <map> is implemented as a balanced binary search tree with const key values. this is nice, you get O(log n) search, insert, delete, etc runtimes. O(n) enumeration time.

What I’m wondering is the underlying data structure of PHP arrays. There are a few SO posts on PHP arrays that say “well they do pretty much the same thing, so don’t worry about it!”. not what I’m after. Is it O(1) (hash table) or O(log n) (balanced binary tree) lookup? (for example)

If anyone can help me out or point me to the right PHP C source file, that would be awesome (though a little explanation would be good – I’m really bad at C). Or if you just have cool insights about PHP arrays that’s good as well – I’m trying to understand the entire underlying data structure.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:36:24+00:00Added an answer on May 27, 2026 at 10:36 pm

    An array in PHP is actually an ordered map. A map is a type that
    associates values to keys. This type is optimized for several
    different uses; it can be treated as an array, list (vector), hash
    table (an implementation of a map), dictionary, collection, stack,
    queue, and probably more. As array values can be other arrays, trees
    and multidimensional arrays are also possible.

    The implementation is in fact some sort of a HashTable.

    -> http://php.net/manual/en/language.types.array.php
    -> How is the PHP array implemented on the C level?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just listening to this week's podcast and thought it would be nice to group
I probably just haven't thought this through, or perhaps I'm simply unaware of an
I thought I had this figured out but it turns out I'm just deleting
Just thought it would be nice to have one but my PS skills are
i dont think this is possible but just thought i'd ask as a last
I thought that to clone a List you would just call: List<int> cloneList =
OK thought I understood IDipose but just reading the best practices section of Accelerated
I thought that layout is just a widget that keeps more widgets inside. But
I have a situation that I thought would be straightforward and fairly common but
This is a really easy one that I thought would be easily found on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.