- Output for 7.1.0 - 7.1.10, 7.2.0 - 7.2.6
- seq array: 8998512 bytes seq+assoc array: 23028512 bytes
- Output for 7.0.0 - 7.0.20
- seq array: 8998456 bytes seq+assoc array: 23028456 bytes
<?php
$array = [];
$startMemory = memory_get_usage();
foreach (range(1, 100000) as $i) {
$array[] = "adfsdfghsfghfsgh $i";
}
echo "seq array: ", memory_get_usage() - $startMemory, " bytes\n";
foreach (range(1, 100000) as $i) {
$array["test$i"] = "sdfghsfghsfg $i";
}
echo "seq+assoc array: ", memory_get_usage() - $startMemory, " bytes\n";