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
webbiedave
2010-06-08 16:22:00
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
2010-06-08 16:25:19
Also please note that using regular expressions in that case is a huge overuse.
Crozin
2010-06-08 16:26:00
@HackedByChinese: You're right. Changing.
webbiedave
2010-06-08 16:28:03
And that if a third argument is given `, $arrow, $matches)` it will be populated with the match information (array).
Dan Heberden
2010-06-08 16:28:36