isValid

Learn how to check whether a string is a valid UUID.

This method checks whether the given string is a valid UUID.

The check is case-insensitive, so both uppercase and lowercase values are accepted.

Signature

This method has the following signature:

public static function isValid(string $value): bool

This method returns true when the value is a valid UUID, or false otherwise.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Uuid;
$valid = Uuid::isValid('f47ac10b-58cc-4372-a567-0e02b2c3d479');

Parameters

The following list describes the supported parameters:

value
string

The string to validate.