= 8) { $matchedBitIndex = $j; } } } // Actually, just check each position manually $expectedFormatBit = $formatBinary[$i]; $match = $actualBit === $expectedFormatBit ? '✅' : '❌'; if ($match === '❌') { // Find what it should be for ($j = 0; $j < 15; $j++) { if ($formatBinary[$j] === $actualBit) { echo sprintf("%11d | %6d | %9s | %10s | Bit %d %s\n", $i, $col, $expectedFormatBit, $actualBit, $j, $match); break; } } } else { echo sprintf("%11d | %6d | %9s | %10s | Bit %d %s\n", $i, $col, $expectedFormatBit, $actualBit, $i, $match); } } echo "\n=== Conclusion ===\n"; echo "Positions that need swapping in horizontal:\n"; echo "Reading pos 9 (col 19): Use bit 10 instead of bit 9\n"; echo "Reading pos 10 (col 18): Use bit 9 instead of bit 10\n"; echo "Reading pos 12 (col 16): Use bit 13 instead of bit 12\n"; echo "Reading pos 13 (col 15): Use bit 12 instead of bit 13\n";