3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = memory_get_usage(); $names = array_fill(0, 1000, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); echo "10k values in a 1000x10 matrix: ", round((memory_get_usage()-$start)/1024),"KB\n"; $names = array_merge(...$names); echo "Same 10k values in a plain vector: ", round((memory_get_usage()-$start)/1024),"KB\n";
Output for 8.2.0 - 8.2.24, 8.3.0 - 8.3.16, 8.4.5
10k values in a 1000x10 matrix: 20KB Same 10k values in a plain vector: 260KB
Output for 7.3.33, 8.1.0 - 8.1.30
10k values in a 1000x10 matrix: 36KB Same 10k values in a plain vector: 516KB

preferences:
74.94 ms | 407 KiB | 5 Q