What are the advantages and disadvantages of using xampp compared to individually installing PHP, Apache, and MySQL for setting up phpmyadmin on a local server?

When setting up phpMyAdmin on a local server, using XAMPP can be advantageous as it provides a simple and easy-to-use package that includes PHP, Apache, and MySQL all in one. This eliminates the need to individually install and configure each component separately. However, using XAMPP may also lead to security vulnerabilities if not properly configured and updated regularly.

<?php
// PHP code snippet to connect to MySQL using XAMPP
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>