Welcome Guest, Not a member yet? Register   Sign In
Replacing valid_email() with filter_var()
#1
Question 

According to this description the valid_email() function is deprecated and scheduled for removal in CodeIgniter 3.1+. The web page says that the PHP function filter_var() should be used instead.

But filter_var() takes two arguments, whereas valid_email() only takes one. So how do I specify a two-argument function with a fixed second argument in a form validation list?

For example this example uses this code:

Code:
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');


How can I replace valid_email here with filter_var with FILTER_VALIDATE_EMAIL as the second argument? Or am I supposed to write my own valid_email() function?

--
Claus
Reply


Messages In This Thread
Replacing valid_email() with filter_var() - by oz1cz - 05-03-2016, 02:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB