What is the purpose of using "unset($var)" in PHP and how does it affect performance?

When you use "unset($var)" in PHP, it removes the variable from memory, freeing up the memory it was occupying. This can be useful when you no longer need a variable and want to optimize memory usage. However, overusing unset() can lead to unnecessary memory management operations which can affect performance.

$var = "Hello, World!";
unset($var);