0

i am new to php . i want to know the place where the array data and the address of array are being stored ? are they storing in heap and stack , respectivelylike C# ?

I read many articles but I could not found the answer . I used bard to find the answer but I am not sure that is correct . his answer is both of array data and its address are stored in heap

Olivier
  • 13,283
  • 1
  • 8
  • 24
  • Any particular reason why you need to know? One of the advantages of a lot of languages like this is that you don't need to manage the memory and so concentrate on the algorithm rather than managing memory. – Nigel Ren Aug 26 '23 at 12:27
  • 1
    Everything is stored on the heap. – Olivier Aug 26 '23 at 13:00
  • https://www.npopov.com/2012/03/28/Understanding-PHPs-internal-array-implementation.html – John Hanley Aug 26 '23 at 19:40

1 Answers1

0

The actual values you store in an array are stored in blocks of memory. PHP optimizes this storage by PHP's Zend Engine, to efficiently hold various types of values (integers, strings, objects, etc.). and also uses a hash table (hash map) internally to manage the association types. but the detail of how the PHP Engine works with the values and addresses is related to its kernel, and not to the place they are stored.