Strange PHP memory usage in array of strings

one text

Solution:

Strings in PHP are immutable, which means they can't be changed. This also implies that they can easily be shared. In the first case, you have an array with 100k elements, each referencing a different string. In the second case, you have an array with 100k elements, each referencing the same string.

For further reference, take a look at www.phpinternalsbook.com.

Source