filter_var problems
Using CS4 and PHP 5.2, I have the following php code:
$mailarray = explode("\n", trim($formvars['manual']));
$tolist['email'] = array();
foreach ($mailarray as $value)
{
if (filter_var($value, FILTER_VALIDATE_EMAIL))
$tolist['email'][] = $value;
}
$formvars['manual'] comes from a form textarea and is a list of email addresses entered as one per line - and I want to ignore lines that contain invalid emails. My basic problem is that the $tolist array never gets populated (looks like filter_var always returns false). I am sure I'm just making a stupid mistake..?
Ed
PS CS4 doesn't show filter_var as a 'blue' function in the code window, so I assume doesn't recognise it (I wonder how one can tweak that), but my version of PHP definitely does.
