[PHP] One pass solution O(n) 0ms, faster than 100.00%
\nclass Solution {\n\n    /**\n     * @param String $s\n     * @return Integer\n     */\n    function maxLengthBetweenEqualCharacters($s) {\n        $map = [];\
```\nclass Solution {\n\n    /**\n     * @param String $s\n     * @return Integer\n     */\n    function maxLengthBetweenEqualCharacters($s) {\n        $map = [];\n        $max = -1;\n\n        foreach (str_split($s) as $i => $ch)\n            if (!isset($map[$ch])) {\n                $map[$ch] = $i;\n            } elseif ($i - $map[$ch] - 1 > $max) {\n                $max = $i - $map[$ch] - 1;\n            }\n\n        return $max;\n    }\n}\n```
['PHP']