Thanks NYSiRacer!
It works great... it even accomplishes my next task of parsing out the area code, but there is one problem though. In scanning my db I noticed that a small percentage of my users entered "1-" at the beginning of the phone number. The way your code is set up now, if a user enters a phone number like 1-234-456-6789 $areacode will return 1.
Is there an easy work around?
The way I was doing it with my code in my initial post is like this:
$areacode = ($num[0] == '1') ? substr("$num", 1, 3) : substr("$num", 0, 3);
where $num is the phone number without any non-numerical characters.
I'm not sure how I can get around this with your code though.