php variables inside functions vs outside
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5912036/php-function-variable-scope">php function variable scope</a>  </p>
</blockquote>



<p>is there any reason i can't push these variables in the function?
if i do this</p>

<pre><code>//function scraping_for_text_2
for($i=0; $i&lt;$l; $i++) { 
echo "$contents[$i]";
echo "$fnamearray[$i].torrent";
}
</code></pre>

<p>it echoes back the correct vaules</p>

<p>but when i have an function like this</p>

<pre><code>function scraping_for_text_2($iUrl,$iText)

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $uploadurl);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($curl, CURLOPT_POST, true);
 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); 
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$curlresult = curl_exec($curl);
curl_close ($curl);
                      $data = array( 

"description" =&gt; "testing",
"torrent" =&gt; "@$fnamearray[$i]",
"submit" =&gt; "Upload"
);
</code></pre>

<p>i get this
Notice: Undefined variable: fnamearray 
Notice: Undefined variable: i in </p>
