Lessons: 26Length: 1.7 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

5.2 Matching a US Phone Number, and Named Captures

A U.S. phone number takes a particular kind of syntax including an area code, a prefix and then the line number. In this lesson we'll go back over to PHP and use our preg_match() function to select a phone number and separate it's parts. Using indexes to do this can get confusing, so we'll learn how to use named captures instead.