rlange - 8:43 pm on Jun 11, 2012 (gmt 0)
The use of
next() is what's messing things up. The
foreach loop automatically advances to the next element in the array, so there's no need for you to do it "manually".
Note: It's best to be as explicit as possible. Yes,
if( $value == true ) and
if( $value ) will work if
"1", but it will also "work" if
"foo". That's probably not a good thing.
if( $value == true ) should be
if( $value === 1 ) (if
$value is an actual integer) or, even better,
if( 1 === $value ). Getting into the habit of placing the variable on the right means that you avoid this sort of "whoops!" moment:
if( $value = 1 ).