Answers for "evaluate home tilde ~ in php"

PHP
0

evaluate home tilde ~ in php

function expand_tilde($path)
{
    if (function_exists('posix_getuid') && strpos($path, '~') !== false) {
        $info = posix_getpwuid(posix_getuid());
        $path = str_replace('~', $info['dir'], $path);
    }

    return $path;
}
Posted by: Guest on September-23-2021

Browse Popular Code Answers by Language