How can the output of data retrieved from a database be controlled and customized in PHP?

To control and customize the output of data retrieved from a database in PHP, you can use PHP functions like `mysqli_fetch_assoc()` or `mysqli_fetch_array()` to fetch data from the database query result. You can then manipulate the data, format it, and display it as needed using PHP code.

// Assuming $result is the result of a database query
while ($row = mysqli_fetch_assoc($result)) {
    echo "Name: " . $row['name'] . "<br>";
    echo "Age: " . $row['age'] . "<br>";
    // Customize and format the output as needed
}