[Community Puzzle] Happy Numbers

When I have code this on Php, I have had a problem with the “\n”.
The last ligne was wrong because the end of response was a “\n”. But I was coding in same time , in same language (Php) with the same external Ide and moreover use him code. My friend haven’t this problem but me yes.
A problem of Codingame Ide ? @deltaspace

Review and updated the test case formatting. Would you try again?

I copy the response of my firend who have 100% - ArchibaldWirslayd
The result is the same : For first test I have
Trouvé : 24 :(End of line (\n)
Attendu : 24 :(Nothing
I succed by changing the display method of the response

php was designed for generating web pages which, I am not sure, may have special handling for CR and LR because browsers handle newlines in html in special ways.

I tested my code for all test cases and validators and passed with no surprise. My code is using C style printf("%d :)\n", a);
or printf("%s :)\n", s);

I understood. I know that Php is a web language. But I found anormal that In exactly same conditions. The same code submit at same time give different result.
I have tryed with ascii code for chars, and he give me the code, not the char linked on ascii code. So I suppose that all chars are escape to protect the ide except the importants like “\n” who is the unique way to pass to the next line . “<br>” are use for html but he is escape .

on conclusion I don’t know why I have had this problem. Maybe unluck.
I hope to find a solution for the future or challenge the staffs.

again thx for your responses.

Encore merci pour tes réponses. (j’avoue je suis francophone ^^)

Remember that php also have printf().
Have you tried using it to replace all these echo, log, print, etc?

@Gaiel It’s almost impossible to understand your problem without a sample of code. Do you mean the currently published PHP solution by ArchibaldWirslayd raises that error when you run it?

exactly @Niako

print_f, print_r give the same result like echo And I have tried to replace "\n" with "\r\n" or PHP_EOL .the result is same. @java_coffee_cup

Based on the php manual there is no print_f, but there is printf()

Anyway, as you have passed it with php, you can view other php coders’ solutions to find out how they can do it without error and without special handling of newlines.

Yeah but, as far as I understand, he is claiming that some accepted solutions (or at least one) raise an error when he runs them (on the tests).

This strange situation is too odd to understand.

In this kind of inconsistent and random errors, often I would suggest performing the same task in a different browser, or better a different computer, in a different network, so that there can be various combinations of independent testing results as reference.

Some special reasons I have come across are: virus infection, or the user installed a plug-in to browser that automatically manipulates text input, or a malfunctioned keyboard that output key signals in random intervals, or company’s intranet has kinds of monster monitoring software. Would like to hear if there are other strange causes.

the only thing i could say is.
in the generate code for php, at the start of problem (any probleme) he is asking to

// Write an action using echo(). DON'T FORGET THE TRAILING \n
// To debug (equivalent to var_dump): error_log(var_export($var, true));

That’s indeed a good start (one could also start by clearing the cache, or monitoring the network request when clicking on “play” to make sure the code you send is indeed the one you see in the IDE).