In PHP, how do I create arrays for production systems?

PHP, Arrays, Associative Arrays, Production Systems, Data Structures
This example demonstrates how to create and manipulate arrays in PHP for production systems, highlighting both indexed and associative arrays.
<?php // Indexed Array $fruits = array("Apple", "Banana", "Orange"); // Associative Array $person = array( "first_name" => "John", "last_name" => "Doe", "age" => 30 ); // Accessing array elements echo $fruits[1]; // Outputs 'Banana' echo $person["first_name"]; // Outputs 'John' // Adding a new fruit $fruits[] = "Grapes"; // Updating a person's age $person["age"] = 31; // Loop through indexed array foreach ($fruits as $fruit) { echo $fruit . "<br>"; } // Loop through associative array foreach ($person as $key => $value) { echo $key . ": " . $value . "<br>"; } ?>

PHP Arrays Associative Arrays Production Systems Data Structures