Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does php view the memory occupied by a variable?
How does php view the memory occupied by a variable?
As we mentioned in the previous efficient php writing, try not to copy variables, especially arrays. Generally speaking, the memory utilization rate of PHP arrays is only110, that is, an array with 100M memory in C language, and 1G is required in PHP. Below we can roughly estimate the memory occupied by PHP arrays. First, we test the memory occupied by an integer of 1000 elements:

Three-dimensional arrays actually consume 23M, and small arrays are really not cost-effective.