Not sure why I am getting an “Empty needle in…” warning for Line 12 of the following code:
1 function check_usstate($usstate, $optional)
2 {
3 $list_usstates = '|AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC'
4 . '|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS'
5 . '|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO'
6 . '|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP'
7 . '|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN'
8 . '|TX|UT|VT|VI|VA|WA|WV|WI|WY|';
9
10 if ( (strlen($usstate) == 0) && ($optional === true) ) {
11 return true;
12 } elseif (strpos($list_usstates, strtoupper($usstate)) === false ) {
13 return false;
14 } else {
15 return true;
16 }
17 }
Any help, thoughts or comments are appreciated. Thanks!