3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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";
based on RZDVf
Output for 7.1.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
Output for hhvm-3.15.4
seq array: 6291456 bytes
Process exited with code 139.
Output for 5.6.3 - 5.6.30
seq array: 18649248 bytes seq+assoc array: 38889144 bytes
Output for 5.6.0 - 5.6.2
seq array: 18649248 bytes seq+assoc array: 38889152 bytes