• PHP foreach ($bigbigbig_array as $key => &$value)
    {
    # your code here (you can even modify $value and it’ll get into original array)
    }
    unset($value); // Safety
    ♡ recommended by @fmap

Replies (2)

  • @plumbum, Удобно.
  • @fmap, оно не только удобно, но ещё и памяти меньше жрёт и работает шустрее.
    ~/tmp/php:$ php test1.php
    mems 49.57Mb
    Gen time: 0.18468594551086
    Computed time: 0.22072196006775
    ~/tmp/php:$ php test1.php
    mems 29.61Mb
    Gen time: 0.15279507637024
    Computed time: 0.16283106803894
    gist.github.com