BlogNotesAbout
moon indicating dark mode
sun indicating light mode

VIM substitution for deprecated PHP each method

The command:

s/while *(list(\($.\+\), \($.\+\)) = each(\(.\+\)))/foreach(\3 as \1 => \2)/

will replace while -> list -> each iterations over associated arrays such as:

while (list($key, $package) = each($filter->filtered_packages['ups'])) {

with something like:

foreach($filter->filtered_packages['ups'] as $key => $package) {