Array in a recursive function
<p>I have this recursive function in which I must use an array for memory and verification of used data, meaning, after a string has been used i would like to remember that it has been used so i will not go over that string again in the next iteration. 
The problem is after the first iteration the array is considered NULL. </p>

<p>So my question is this : How do i pass an array in a recursive function ? or how do i work with arrays in recursive function? </p>

<p>I looked this up here and though there are many similar questions none answer my one. </p>

<p>Note: I understand that anything that can be done with recursion can be done with a loop... yet... this is the function. And like i mentioned on the 2nd iteration the array is considered to be NULL and i get this warning: </p>

<p>array_push() expects parameter 1 to be array, null given in...</p>

<p>Hears the logic of the function: </p>

<pre><code>// Set Vars...
$Str = 'someData';
$S_Array = array();

 // initial call...
GetData($Str, $S_Array);

 function GetData ($string, $array){
   // string manipulations code... 

   .
   .
   .
   .
   // Attempt to Store in array

   array_push($array, $string);
   foreach($array as $val){
   // Recursive Call... 

     GetData($val, $array);
   }
 }
</code></pre>
