How can PHP be used to filter and display specific information from a larger dataset?

To filter and display specific information from a larger dataset in PHP, you can use conditional statements and loops to iterate through the dataset and only display the information that meets your criteria. You can use functions like array_filter() to filter arrays based on specific conditions, or use SQL queries if the data is stored in a database.

<?php
// Sample dataset
$dataset = array(
    array('name' => 'John', 'age' => 30),
    array('name' => 'Jane', 'age' => 25),
    array('name' => 'Alice', 'age' => 35),
);

// Filter dataset to only display people over 30 years old
$filteredData = array_filter($dataset, function($item) {
    return $item['age'] > 30;
});

// Display filtered data
foreach ($filteredData as $item) {
    echo $item['name'] . ' is ' . $item['age'] . ' years old <br>';
}
?>