`$defaults[$pid] = in_array($pid, $selected);` would be more readable.