PHP. T - O(n), M - O(1).
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)$$ -->\nO(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution {\n\n    /**\n     * @param Integer $n\n     * @return Integer[]\n     */\n    function evenOddBit($n) {\n        $flag = false;\n        $res = [0,0];\n        while($n > 0){\n            if($n & 1){\n                $res[$flag]++;\n            }\n            $n >>= 1;\n            $flag = !$flag;\n        }\n        return $res;\n    }\n}\n```
['PHP']