Given this array: $categories = array(4,15,21,83,122); the following for loop should be replacing the number 15 with the number 0 but instead it's replacing all the numbers with 0. $n = count($categories); for($i=0; $i<$n; $i++) { if ($categories[$i] = 15) { $categories[$i] = 0; } } Code (markup): I'm at a loss to figure this out.
Ah hell! I can't tell you how long I've stared at that piece of code and that never occurred to me. Thanks szalinski, now I can move on to my next obvious bug.