Easy solution with php
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public function getSmallestString($s, $k) {\n        $res = "";\n        $len = strlen($s);\n\n        for ($i = 0; $i < $len; $i++) {\n            $char = $s[$i];\n            $min_d = min(ord($char) - ord(\'a\'), ord(\'z\') - ord($char) + 1);\n\n            if ($k >= $min_d) {\n                $k -= $min_d;\n                $res .= ($min_d <= ord($char) - ord(\'a\')) ? \'a\' : \'z\';\n            } else {\n                $res .= chr(ord($char) - $k);\n                $k -= $k;\n            }\n        }\n\n        return $res;\n    }\n}\n\n```
['PHP']