What is the purpose of removing escape slashes from the POST array in PHP?

When data is submitted through a form using POST method in PHP, the data is automatically escaped with slashes to prevent SQL injection attacks. However, sometimes it is necessary to remove these escape slashes before using the data in SQL queries or other operations. This can be done using the stripslashes() function in PHP.

// Remove escape slashes from POST array
foreach ($_POST as $key => $value) {
    $_POST[$key] = stripslashes($value);
}