nette / utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
https://doc.nette.org/utils
Other
1.98k stars 147 forks source link

ArrayList support returning references #289

Closed duncanxia97 closed 1 year ago

duncanxia97 commented 1 year ago
$arrayList = ArrayList::form([['id'=>1],['id'=>2]]);
// $arrayList => [['id'=>1],['id'=>2]]
foreach($arrayList as &$item)
{
    $item['id'] += 1;
}
unset($item);
// $arrayList => [['id'=>2],['id'=>3]]
dg commented 1 year ago

Thanks