id/misc_functions.php

14 lines
432 B
PHP
Raw Normal View History

2023-11-10 21:19:08 +00:00
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[random_int(0, $charactersLength - 1)];
}
return $randomString;
2023-11-19 12:24:38 +00:00
}
function current_git_commit():string {
return trim(exec("git log --pretty=\"%h\" -n1 HEAD 2>&1"));
2023-11-10 21:19:08 +00:00
}