Pass a PHP array to a function?
<p>I have the following code:</p>

<pre><code>$params = array(
    'api_user'  =&gt; $user,
    'api_key'   =&gt; $pass,
    'to'        =&gt; 'test@test.com',
    'subject'   =&gt; 'testing from curl',
    'html'      =&gt; 'testing body',
    'text'      =&gt; 'testing body',
    'from'      =&gt; 'from@from.com'
);  

/* Put the below into a function */
$request =  'api url goes here';
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
print_r($response);
/* Put the above into a function */
</code></pre>

<p>Basically I want to put the above code between the comments into a function, so that I can set the params and then do the following:</p>

<pre><code>sendthat($params);
</code></pre>

<p>This is to simply clean up my page, and have the curl request grabbing the array via a function.</p>

<p>How can I pass the array to a function?</p>
