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"; } $seq = memory_get_usage() - $startMemory; echo "seq array: $seq bytes\n"; foreach (range(1, 100000) as $i) { $array["test$i"] = "sdfghsfghsfg $i"; } $seqassoc = memory_get_usage() - $startMemory; echo "seq+assoc array: $seqassoc bytes\n"; echo "multiplier: " . $seqassoc / $seq;
based on PKaSN
Output for 7.1.0 - 7.2.6
seq array: 8998480 bytes seq+assoc array: 23028512 bytes multiplier: 2.5591557685298
Output for 7.0.0 - 7.0.20
seq array: 8998424 bytes seq+assoc array: 23028456 bytes multiplier: 2.5591654716426
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: 18649208 bytes seq+assoc array: 38889288 bytes multiplier: 2.0853050703279
Output for 5.6.0 - 5.6.2
seq array: 18649192 bytes seq+assoc array: 38889248 bytes multiplier: 2.0853047145421