[eluser]xwero[/eluser]
I don't think your check will ever be true or will always be true. The way your $type[‘item’]==$type[‘value’] works if you add an array to as the parameter to the rule with the keys item and value. The type of a POST value is most of the time a string but because php has weak typing you can check if it's numeric too. The numeric rule is in the Validation library and it also as a few rules to check the formating of the string.
You could add a check to see if the value for the post key is an array but that is it so your function would look like this
Code:
function($val,$type)
{
$types = array('string','numeric','float','array');
if( ! in_array($type,$types))
{
return FALSE;
}
$function = 'is_'.$type;
if( ! $function($val))
{
return FALSE;
}
return TRUE;
}