PHP || Union Find || Easy understand
Code\n\nclass Solution {\n\n    /**\n     * @param String $s1\n     * @param String $s2\n     * @param String $baseStr\n     * @return String\n     */\n    priv
# Code\n```\nclass Solution {\n\n    /**\n     * @param String $s1\n     * @param String $s2\n     * @param String $baseStr\n     * @return String\n     */\n    private $representative = [];\n    function smallestEquivalentString($s1, $s2, $baseStr) {\n        for ($i = 0; $i < 26; $i++) {\n            $char = chr($i + ord(\'a\'));\n            $this->representative[$char] = $char;\n        }\n\n        for ($i = 0; $i < strlen($s1); $i++) {\n            $this->performUnion($s1[$i], $s2[$i]);\n        }\n\n        $ans = "";\n        for ($c = 0; $c < strlen($baseStr); $c++) {\n            $ans .= $this->find($baseStr[$c]);\n        }\n\n        return $ans;\n    }\n    \n    private function find(string $x): string {\n        if ($this->representative[$x] === $x) {\n            return $x;\n        }\n\n        return $this->representative[$x] = $this->find($this->representative[$x]);\n    }\n\n    private function performUnion(string $x, string $y) {\n        $x = $this->find($x);\n        $y = $this->find($y);\n\n        if ($x == $y) {\n            return;\n        }\n\n        if ($x < $y) {\n            $this->representative[$y] = $x;\n        } else {\n            $this->representative[$x] = $y;\n        }\n    }\n}\n```
['PHP']