Skip to content
Advertisement

Recursive function and add to an array

I need recursive function to add element into an array. This is my code:

JavaScript

Basically, if I echo $new_x and $new_y, I get what I’m expecting. Problem is my $result array, it gives me only first item (2 -2) but second is missing (1 -1). I guess problem is with adding item into array but cannot find the problem.

Advertisement

Answer

I found solution if somebody need.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement