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 992849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:19:50+00:00 2026-05-16T06:19:50+00:00

In PHP an Associative Array keeps its order. // this will keep its order

  • 0

In PHP an Associative Array keeps its order.

// this will keep its order in PHP
a['kiwis']
a['bananas']
a['potatoes']
a['peaches']

However in Flex it doesn’t with a perfectly valid explanation. I really can’t remember how C treats this problem but I am more leaned to believe it works like php as the Array has it’s space pre-reserved in memory and we can just walk the memory. Am I right?

The real question here is why. Why does C/PHP interpretation of this varies from Flash/Flex and what is the main reason Adobe has made Flash work this way.

Thank you.

  • 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-16T06:19:50+00:00Added an answer on May 16, 2026 at 6:19 am

    For PHP arrays: These beasts are unique constructs and are somehow complicated, an overview is given in a slashdot response from Kendall Hopkins (scroll down to his answer):

    Ken: The PHP array is a chained hash table (lookup of O(c) and O(n) on key collisions)
    that allows for int and string keys. It uses 2 different hashing algorithms
    to fit the two types into the same hash key space. Also each value stored in
    the hash is linked to the value stored before it and the value stored after
    (linked list). It also has a temporary pointer which is used to hold the
    current item so the hash can be iterated.

    In C/C++, there is, as has been said, no “associative array” in the core lanuage. It has a map (ordered) in the STL, as will be in the new standard library (hash_map, unordered_map) and there was a gnu_hash_map (unordered) on some implementations (which was very good imho).

    Furthermore, the “order” of elements in an “ordered” C/C++ map is usually not the “insertion order” (as in PHP), it’s the “key sort order” or “string hash value sort order“.

    To answer your question: your view of equivalence of PHP and C/C++ associative arrays does not hold, in PHP, they made a design decision in order to provide maximum comfort under a single interface (and failed or succeeded, whatever). In C/C++, there are many different implementations (with advantages and tradeoffs) available.

    Regards

    rbo

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

Sidebar

Related Questions

How to order this tricky PHP associative array? I have this associative array: Array
In php, I would like to have the ability to re-order an associative array
In PHP, I have an associative array like this $a = array('who' => 'one',
Given a PHP associative array like this one: $a = array( 'color' => 'red',
Ok I have this kind of associative array in PHP $arr = array( fruit_aac
i have an associative array in PHP. $myarray = array( a=>News, b=>Articles, c=>images );
I want to use an associative array with the PHP iterator: http://php.net/manual/en/class.iterator.php is it
I'm trying to build an associative array in PHP dynamically, and not quite getting
I want to convert PHP list (array), i.e. array(start, end, coords) into associative array
Possible Duplicate: php loop through associative arrays i have this piece of code which

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.