W3cubDocs

/Symfony 2.7

Symfony\Component\Security\Core\Util\StringUtils

class StringUtils

String utility functions.

Methods

static bool equals(string $knownString, string $userInput)

Compares two strings.

Details

static public bool equals(string $knownString, string $userInput)

Compares two strings.

This method implements a constant-time algorithm to compare strings. Regardless of the used implementation, it will leak length information.

Parameters

string $knownString The string of known length to compare against
string $userInput The string that the user can control

Return Value

bool true if the two strings are the same, false otherwise

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Component/Security/Core/Util/StringUtils.html