The way I understand this is that in the first instance, you're creating the $epoch variable before it's used within the expression.

In the second example, however, you create the variable at the same time as you attempt to use it. As the variable doesn't exist until after the statement is executed (which doesn't happen until the compiler hits the semi-colon), it's not possible to pass it into a function within that statement.

I will point out that I'm not 100% sure about this, though - this is based on someone else's attempt at explaining a similar problem to me.