I'm using preg_match() to check if a user inputted string matches a required format. Previously, the local version of the website returned the same value as the production version, however, now the local version is returning False when it should be True.
Here's a sample of the code I'm using to validate a user's first name:
$firstName = 'John';
if (preg_match("/^[A-Z\p{L}][A-Z\' -\p{L}]{0,49}$/ui", $firstName)) {
echo 'True';
} else {
echo 'False';
}
The local version incorrectly returns False. In case it's relevant, it's running PHP version 5.5.17.
The production version correctly returns True. In case it's relevant, it's running PHP version 5.3.29.
I don't see any recent changes in the PHP spec for preg_match. Can anyone tell me why these 2 versions of the website return differing values when using the same code? Thank you.