0

The complexity of fetching value from an array by index is O(1), which is well explained here . What about fetching from php associative arrays by keys where keys may be reasonably long alphanumeric strings - about 20-30 characters? I am trying to optimize a program which uses php associate arrays which is having nested loops.

Jayadevan
  • 1,306
  • 2
  • 12
  • 33
  • Something more PHP relevant to array access - https://stackoverflow.com/questions/2473989/list-of-big-o-for-php-functions – Nigel Ren Mar 02 '20 at 07:41
  • 1
    key access for associative array can be O(n) in case of hash collisions. But, can you share the code you are trying to optimize? Maybe it's less about hash collisions and more about some loop complexity overhead. – nice_dev Mar 02 '20 at 07:47

0 Answers0