Stated more generally: whenever x=y, a true property involving x will remain true after substituting y for all occurrences of x in the property.
For instance, the following "function" violates referential transparency by changing the value of the global variable y:
Assume that referential transparency holds. Therefore, if z1 = z2 then f(z1) = f(z2). Suppose that z1=z2=y=0. Then the expression f(z1)==f(z2) should return true. But whichever side of the "==" is evaluated first will increment y, which will result in the other side being evaluated differently. Therefore, the referential transparency cannot hold.
function f(x:integer):integer;
begin
y := y + 1;
f := y + x
end