thanks for reply as i have fixed my code tag problem , sorry for inconvenience
actually , i am taking interrupt from a plc on my esp32 where my d2 and d4 pins stays in high condition as per plc pins as the plc pins get low i make my d2 and d4 pins low as it is but they dont go low at the same moment, so i am looking for a solution where i check for both pins to be low then increment the count