I want to check a valid contact number:-
- The number may or may not start with a + sign.
- The number may contain
space
and hyphen (-) sign. - There should be no consecutive hyphen (-) sign.
- There should be no other alphabets, special characters, etc.
An example of valid contact number is + 91-8341239834 or +91 033 2664 3271
The number must not exceed 20 characters.
How can I do this?
here is my code till now:-
preg_match('/^[0-9 .\-]+$/i', $number)