Hi,
yes, this is good refactoring, but better refactoring would be:
- avoid generic names like $a, $b
- avoid using the constant 8, instead counting the elements in the array

Using a loop, like you did, is what I had in mind when I proposed this
challenge. Technically, after refactoring, the code had to produce the
same output, as I suspect your example does.

In this discussion, however, code improvement was gained not just by
refactoring, but by examining the reasons behing the code and
simplifying it.


--
Marc Delisle
http://infomarc.info


Thanks for the input. and yes, i did appreciate the logical trimming of the code, in the discussion.

--
Prakul Agarwal,
Indian Institute of Information Technology, Allahabad