php passing array to class function
<p>Hello i want to pass array to my class function but i am not getting the value . plz help me out what is the problem with this sample code </p>

<pre><code> &lt;?php
if(isset($_POST['submituser']))
{
$user = new User();
$user-&gt;connect();
$name=$_POST['name'];
$age=$_POST['age'];

$result = array($name=&gt;$name,$age=&gt;$age);


$user-&gt;setUser($result);

$user-&gt;disconnect();
}
?&gt;
</code></pre>

<p>and the class function is like this </p>

<pre><code>function setUser($result) 
{
echo $result[$name];
$errors_all = array();
$validate = new Validator();
$validate-&gt;addRequiredFieldValidator($result[$name],"First name is required.")."";
}
</code></pre>

<p>i can get by $result[0] by i want to get it by value 
Thanks</p>
