3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // 标准array // $array = array(1024 * 1024); // array(); // for ($i = 0; $i < 1024 * 1024; ++$i) // $array[$i] = 0; // echo 'Standard array: '.memory_get_peak_usage(); // spl $SplFixedArray = new SplFixedArray(1024 * 1024); // array(); for ($i = 0; $i < 1024 * 1024; ++$i) $SplFixedArray[$i] = 0; echo 'SplFixedArray: '.memory_get_peak_usage();
based on raMDI
Output for 7.2.0
SplFixedArray: 17160680
Output for 7.1.0, 7.1.7 - 7.1.10
SplFixedArray: 17124008
Output for 7.1.5 - 7.1.6
SplFixedArray: 17124176
Output for 7.0.0 - 7.0.20
SplFixedArray: 17124040
Output for 5.5.24 - 5.6.28
SplFixedArray: 58938624
Output for 5.4.10 - 5.4.45
SplFixedArray: 58939064
Output for 5.3.20 - 5.3.29
SplFixedArray: 59342632