Last active
August 29, 2015 14:17
-
-
Save arysom/081ece195ae13dfc7996 to your computer and use it in GitHub Desktop.
validate PL phone number codeigniter function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function validate_phone($phone){ | |
| if( | |
| !preg_match("/\(\d{2}\) \d{3}-\d{2}-\d{2}/",$phone) && | |
| !preg_match("/\d{3}-\d{3}-\d{3}/",$phone) | |
| ){ | |
| $this->form_validation->set_message('validate_phone', 'Pole {field} nie zawiera poprawnego numeru telefonu'); | |
| return false; | |
| } else { | |
| return true; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment