Clash - Flash - Happy Number - PHP - Bug

Hi,

for some days I resolve the 5min Clash: “Check if a positive number is happy or not.”, I do it in PHP and always the 4th case does not match, now I have a screenshot to show the problem.

http://www.file-upload.net/download-11167053/screenshot-wwwcodingamecom2015-12-3020-55-22.png.html

You can see in border2 the output and the expected data of the test case, how you can see in code, I take the number from input and output the number unchanged.

Please could you check, if there is a bug in the PHP test case 4, I only get 75%, when I try to solve the puzzle in PHP.

best regards

Segse

The problem is the input fscanf(STDIN, “%d”, $N);
%d converts the input to

        d - the argument is treated as an
        integer, and presented as a (signed) decimal number.

and the 999999… number is bigger, than MAX_INT_PHP.

For fairness, it was better, if the number was decreased or in php use %s:

         s - the argument is treated as and
         presented as a string.

Here are the specifications of PHP:
fscanf
format output

There is the same problem win many clashes when you use php or javascript. You can’t use a long or a unsigned int. So you are stuck because you just can’t a parse a too big integer. I try to flag every clashes i see with this problem.

not only stucked, you cannot reach 100%.
Well now I know it and next time I am going to modifiy the input to “%f” or “%s”, but an unexperienced coder or new player on CodinGame will not be able to find the reason of the error message, so PHP-Users are handicapped, when the input returns incorrect data.