What improvements can be made to the PHP script to enhance readability and maintainability, considering the current structure and logic?

The PHP script can be improved by breaking down the logic into smaller, more manageable functions and using meaningful variable names. This will enhance readability and maintainability by making the code easier to understand and modify in the future.

<?php

// Original PHP script
function processFormData($data) {
    $result = [];
    foreach ($data as $item) {
        if ($item['status'] == 'active') {
            $result[] = $item;
        }
    }
    return $result;
}

// Improved PHP script
function filterActiveItems($data) {
    $activeItems = [];
    foreach ($data as $item) {
        if ($item['status'] == 'active') {
            $activeItems[] = $item;
        }
    }
    return $activeItems;
}

// Usage
$data = [
    ['id' => 1, 'status' => 'active'],
    ['id' => 2, 'status' => 'inactive'],
    ['id' => 3, 'status' => 'active'],
];

$activeItems = filterActiveItems($data);
print_r($activeItems);

?>