// Two strings are isomorphic if characters in one can be replaced to get the other,
// while preserving the order.
function areIsomorphic(string $s, string $t): bool {
return array_map('strpos', array_fill(0, strlen($s), $s), str_split($s)) ===
array_map('strpos', array_fill(0, strlen($t), $t), str_split($t));
}
var_dump(areIsomorphic("egg", "add"));
var_dump(areIsomorphic("foo", "bar"));
var_dump(areIsomorphic("paper", "title"));
/*
run:
bool(true)
bool(false)
bool(true)
*/