public static function createFromData($data, $upper = false): string
    {
        if (\is_array($data) || \is_object($data)) {
            $data = serialize($data);
        }

        $hash = $upper ? strtoupper(md5($data)) : strtolower(md5($data));

        return implode(
            '-',
            [
                substr($hash, 0, 8),
                substr($hash, 8, 4),
                substr($hash, 12, 4),
                substr($hash, 16, 4),
                substr($hash, 20, 8),
            ]
        );
    }
public static function createFromData($data, $upper = false): string
    {
        if (\is_array($data) || \is_object($data)) {
            $data = serialize($data);
        }

        $hash = $upper ? strtoupper(md5($data)) : strtolower(md5($data));

        return implode(
            '-',
            [
                substr($hash, 0, 8),
                substr($hash, 8, 4),
                substr($hash, 12, 4),
                substr($hash, 16, 4),
                substr($hash, 20, 8),
            ]
        );
    }
public static function createFromData ( $ data , $ upper = false ) : string { if ( \ is_array ( $ data ) || \ is_object ( $ data ) ) { $ data = serialize ( $ data ) ; } $ hash = $ upper ? strtoupper ( md5 ( $ data ) ) : strtolower ( md5 ( $ data ) ) ; return implode ( '-' , [ substr ( $ hash , 0 , 8 ) , substr ( $ hash , 8 , 4 ) , substr ( $ hash , 12 , 4 ) , substr ( $ hash , 16 , 4 ) , substr ( $ hash , 20 , 8 ) , ] ) ; }
Create universal identifier for given data.
Helpful to create unique across then system, but the same when use the same data

@param mixed   $data
@param boolean $upper

@return string
Create universal identifier for given data . Helpful to create unique across then system but the same when use the same data