How does PHP memory actually work
问题 I've always heard and searched for new php 'good writing practice', for example: It's better (for performance) to check if array key exists than search in array, but also it seems better for memory too: Assuming we have: $array = array ( 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, ); this allocates 1040 bytes of memory, and $array = array ( 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ); requires 1136 bytes I understand that the key and value surely will have different storing