Trying to determine the phase difference between two square signals
There are a few things very wrong here.

First problem: you are clocking Timer 2 with the prescaler set to 1.
This means the timer will roll over every 256&nbsp;CPU cycles. Your
input signal, on the other hand, has a period of 25&nbsp;µs, which is
400&nbsp;CPU cycles (I am assuming a 16&nbsp;MHz Arduino). Unless you
know beforehand that the phase difference is within some window less
than 16&nbsp;µs wide, your readings will be ambiguous.

You have to make sure the rollover period of your timer is larger than
the period of the input signal. This means either using a larger
prescaler (8&nbsp;should do), which will decrease your phase resolution,
or using a 16-bit timer instead of an 8-bit timer.

Second problem: you are using a signed integer type for the timer
readings. This makes little sense. Worse: you are computing differences
like t2-t1, which can overflow. Signed integer overflow is undefined
behavior in C++, and
invoking it is always a bug.

You should declare t1 and t2 as unsigned, i.e. either
volatile uint8_t, or volatile uint16_t (if using a 16-bit timer).
Then you don't get overflows: you get instead a well-defined rollover
behavior.

Third problem: you are doing comparisons like if (t2 &gt; t1). This,
again, makes no sense, if only because the timer is repeatedly
rolling-over to zero. You should instead just compute t2-t1 and work
your way from that.