tags:

views:

53

answers:

1

preg_match('/^(AREA|TEST)$/i', $arrow)

+3  A: 

returns 1 if the string (in $arrow) equals area or test, case-insensitive. Else, it returns 0

preg_match

webbiedave
It actually returns the number of times the expression was found, but it will always be 0 or 1, because it stops after the first time the expression was found (as opposed to preg_match_all). I know, tomayto, tomahto.
HackedByChinese
Also please note that using regular expressions in that case is a huge overuse.
Crozin
@HackedByChinese: You're right. Changing.
webbiedave
And that if a third argument is given `, $arrow, $matches)` it will be populated with the match information (array).
Dan Heberden