Thank you for your answer.
I don't clearly understand your point : it is working very fine for cases1, 2 ,3 and 4 (for this one, only if I start with values of X,Y > 0)
For test case 4, I have values :
X = 0
Y = 0
lightX = 36
lightY = 17
For $Y = 1 and $lightY=17 :
case ($Y < $lightY): //move S --> 0<17, should be TRUE, right ?
case ($Y > $lightY): //move N
[...similar switch for $X : 0<36, I should have E]
And I had \n to the echo -> I'm expecting "SE\n" for the 17 first steps.
when beginning with X=0, Y=0 : tests are going crazy and I get NW instead of SE...
I tried same code with X=1, Y=1 : everything is working fine (SE etc)
If someone know what's happening ?
As I said, I'm in PHP : I thought about a type issue, but it doesn't seem to be that.