Collection of useful PHP functions and code snippets.
function identity(mixed $arg): mixed { return $arg; } $interpolate = "identity"; echo "<input value='{$interpolate(1 + 1 * random_int())}' />";See Casting.php
/** * Checks if a folder exist and return canonicalized absolute pathname (sort version) * @param string $folder the path being checked. * @return mixed returns the canonicalized absolute pathname on success otherwise FALSE is returned */ function folder_exist(string $folder): string|false { // Get canonicalized absolute pathname $path = realpath($folder); // If it exist, check if it's a directory return ($path !== false AND is_dir($path)) ? $path : false; }See JSON2Class.php
