Related Links : Search Engine Optimization | | Search Engine Marketing | Online Marketing | Freelance Programmer| SEO Thailand | SEO Expert | SEO services | PHP Programmer Thailand | SEO Tutorial | What is SEO |

  Home Our SEO Services SEO Expert Consultant Php Programmer Scripts| Email : sachin {at} jainsachin {dot} com

PHP | Changes the current umask | Manual | Tutorial | Help

SEO Services



Website Programming in PHP / MYSQL



Friends


    Changes the current umask

    umask

    (PHP 4, PHP 5)

    umask — Changes the current umask

    Description

    int umask ([ int $mask ] )

    umask() sets PHP's umask to mask & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished.

    Parameters

    mask

    The new umask.

    Return Values

    umask() without arguments simply returns the current umask otherwise the old umask is returned.

    Examples

    Example #1 umask() example

    <?php
    $old 
    umask(0);
    chmod("/path/some_dir/some_file.txt"0755);
    umask($old);

    // Checking
    if ($old != umask()) {
        die(
    'An error occured while changing back the umask');
    }
    ?>

    Notes

    Note: Avoid using this function in multithreaded webservers. It is better to change the file permissions with chmod() after creating the file. Using umask() can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask.


    SEO Tutorial / Articles





    Php / Mysql Tutorial



    Articles



      Portfolio


      SEO by Jainsachin