What are the best practices for organizing search criteria in PHP arrays for search functionality?

When organizing search criteria in PHP arrays for search functionality, it is important to structure the array in a way that makes it easy to access and compare the criteria. One common approach is to use associative arrays where the keys represent the search criteria and the values represent the search terms. This allows for easy retrieval of specific criteria and comparison against the search terms.

// Example of organizing search criteria in an associative array
$searchCriteria = [
    'name' => 'John Doe',
    'age' => 30,
    'city' => 'New York',
];

// Accessing and using the search criteria
echo $searchCriteria['name']; // Output: John Doe
echo $searchCriteria['age']; // Output: 30
echo $searchCriteria['city']; // Output: New York