Are there any best practices for naming input fields when working with arrays in PHP forms?

When working with arrays in PHP forms, it is a best practice to name input fields using square brackets in order to pass multiple values as an array. This allows you to easily loop through the array in your PHP code and process the data efficiently.

<form method="post">
    <input type="text" name="items[]" />
    <input type="text" name="items[]" />
    <input type="text" name="items[]" />
    <input type="submit" value="Submit" />
</form>

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $items = $_POST['items'];
    
    foreach ($items as $item) {
        // Process each item in the array
    }
}
?>