0

I'm trying to ignore uppercase or lowercase with the code below to detect whether the user is blocked or not. Is working when matching the username or email but with the case problem, the validation does not work. How to make it case insensitive? Thanks for helping.

$msg = "something";
$blocked = preg_split('/[\r\n]([a-z])([A-Z])+/', admin_get_option('blocked_users'), -1, PREG_SPLIT_NO_EMPTY);

                if ( isset($form['username_or_email']) && in_array( $form['username_or_email'], $blocked) ) {
                    $errors['username_or_email'] = $msg;
                }

                if ( isset($form['user_login']) && in_array( $form['user_login'], $blocked) ) {
                    $errors['user_login'] = $msg;
                }

                if ( isset($form['user_email']) && in_array( $form['user_email'], $blocked) ) {
                    $errors['user_email'] = $msg;
                }
Samual99
  • 15
  • 5

1 Answers1

1

" i " Modifier Makes the match case insensitive

vinod
  • 2,850
  • 1
  • 18
  • 23
  • Hi, thanks but not working for me, perhaps I will use other method to detect this. Have been trying for hours, I gave up on this sorry. – Samual99 Sep 16 '14 at 06:47
  • Please try this its working fine for me.. '/\b[\r\n]([a-z])([A-Z])+\b/i' – vinod Sep 16 '14 at 06:54