X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSystem.php;h=b41f520d7792c614414cda5701ab8e8ab3ee22ed;hb=3020b0fdc4f4ccdfc1deccc23b8748066a7c9979;hp=88b89cda27ac60189375854ecca2a103439ff4d2;hpb=dc4b6ba55996ff2dee23f329502ff41a9d651962;p=friendica.git diff --git a/src/Core/System.php b/src/Core/System.php index 88b89cda27..b41f520d77 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -161,6 +161,18 @@ class System extends BaseObject killme(); } + /** + * Generates a random string in the UUID format + * + * @param bool|string $prefix A given prefix (default is empty) + * @return string a generated UUID + */ + public static function createUUID($prefix = '') + { + $guid = System::createGUID(32, $prefix); + return substr($guid, 0, 8). '-' . substr($guid, 8, 4) . '-' . substr($guid, 12, 4) . '-' . substr($guid, 16, 4) . '-' . substr($guid, 20, 12); + } + /** * Generates a GUID with the given parameters *