1. Rename all instances of: $match to $matches.
2. Change: while (list($key, $val) = each($arr));
to: foreach ($arr as $key => $val);
Find:
Code: Select all
while\s*\(\s*list\((\$\w+),\s*(\$\w+)\s*\)\s*=\s*@*each\(([^)]+\))\s*\)
Code: Select all
foreach \($3 as $1 => $2\)
Code: Select all
(?ms)class\s+(?<CLASS>\w+)\s+\{.+\g{CLASS}\(
There weren't enough of them to bother automating the replacement, so I'll leave that as a challenge for the reader!