Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • unlink() vs unset() Function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 115
    Comment on it

    unlink() Function:

    • This function is used for file system handling.
    • It deletes the file used in context. For example:
    unlink('demo.txt');
    

    The above line will delete the file unlink completely.

    • It includes two parameters: filename which is required parameter and the other is context which is optional parameter.
    • It will return true on success else returns false.
    • Syntax: unlink(filename,context)

    unset() Function:

    • This function is used for variable management.
    • It undefined a variable.
    <?php  
    $demo='hello';  
    echo 'Before using unset() value of $demo is : '. $demo.'<br>';  
    unset($demo);  
    echo 'After using unset() the value of $demo is : '. $demo;  
    ?>  
    

    The above code will give the following output:

    Before using unset() value of $demo is : hello
    After using unset() the value of $demo is :
    
    • It includes one more parameter which are the variables names.
    • It does not return any value.
    • Syntax: unset(var1, var2,.......);

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: