This is what I found in PIC16F1947 data sheet:
Reading the PORTB register reads the status of the pins, whereas writing to it will write to the PORT latch. All write operations are read-modify-write operations. Therefore, a write to a port implies that the port pins are read, this value is modified and then written to the PORT data latch (LATB).
I'm a firmware developer and my background is Computer Science. I still struggle to understand electronics and logic in hardware level. I only have the basic knowledge.
So, I want to understand what happens when data is written to latch in hardware level.