Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Diffrence between unlink() and unset() in php

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 160
    Comment on it

    When we will use unlink() then this function will delete to file test.jpg from given path.

    PHP

    <?php
    unlink("image/test.jpg");
    ?>
    

    When we will use unset() then this function will remove content initialized with the PHP variable $test_text. After using unset() $test_text variable will be empty.

    PHP

    <?php
        $test_text = "Welcome to EVON";
        unset($test_text);
        if(isset($test_text)) {
            echo "<strong>My welcome text is: </strong><i>" . $test_text . "</i>";
        } else {
            echo "<strong>My welcome text is: </strong> empty";
        }
        //output will be My welcome text is: empty
    ?>
    

 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: