Question
I have this code below, I want to add 2 arrays inside it, first array for valid phone number, and the second array for invaild
I have this code below, I want to add 2 arrays inside it, first array for valid phone number, and the second array for invaild phone number like the arrays below, then by using preg_match and foreach loop throw the arrays, if the user input phone number matching the patterns in validphone array like 253.345.5468 print "phone is valid", and if the user input phone number matching the patterns in InValidIphone array like "205-.655-8184" print phone not valid, so the validation here for the patterns in the arrays by php regular expression , please help me with that by php, Thanks
the arrays :
1 - $validIphone=["2534441234","253-434-1234","253.345.5468", "(235) 908 3456"]; 2- $inValidIphone=["(235)-444-1234","(253-434-1234","253)12345678","206-.755-8180","206-4948181","2065438-987","253 345 )5342"];
My Code :
YEAH MATCH!!! Test another phone number Phone number: 253-444-5555 Go! * Sorry that's not a valid phone number Test another phone number Phone number: 253)444-5555 Go
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started