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
<?php
if(isset($_POST['submituser']))
{
$user = new User();
$user->connect();
$name=$_POST['name'];
$age=$_POST['age'];
$result = array($name=>$name,$age=>$age);
$user->setUser($result);
$user->disconnect();
}
?>
and the class function is like this
function setUser($result)
{
echo $result[$name];
$errors_all = array();
$validate = new Validator();
$validate->addRequiredFieldValidator($result[$name],"First name is required.")."";
}
i can get by $result[0] by i want to get it by value Thanks