> (14 - $bitIndex)) & 1; $output .= $bit; } echo "We write: {$output}\n"; echo "Expected: 101111001111100 (vertical)\n"; echo "Match: " . ($output === $ourBinary ? "✅" : "❌") . "\n\n"; echo "The issue: We're SWAPPING when writing, but we should write SEQUENTIALLY!\n"; echo "The swap happens when READING, not writing.\n\n"; echo "Let's write sequentially:\n"; $output2 = ''; for ($i = 0; $i < 15; $i++) { $bit = ($ourFormat >> (14 - $i)) & 1; $output2 .= $bit; } echo "Sequential write: {$output2}\n"; echo "This should match vertical: " . ($output2 === $ourBinary ? "✅" : "❌") . "\n";