Droidik
Droidik

Reputation: 177

Add value to the array in every step of recursion

I have one simple question. How to push a value to the array in every step of recursion? I have a small script that gets content of 10 - 20 urls, gets the image url and it should everytime push the found image url to the array. How to do it?

Upvotes: 1

Views: 297

Answers (2)

Droidik
Droidik

Reputation: 177

Solved by rewriting the function to iteration instead of recursion.

Upvotes: 0

Jan Hančič
Jan Hančič

Reputation: 53931

$yourArray[] = $newElement;

This will push $newElement to the end of your array.

Upvotes: 4

Related Questions