[CLEANUP] Clean up the use of assignments.

- Have no more than one assignment per line.
- Move side-effect assignments out of conditions.
- Use array_search in strict mode.