$static_db = [ "USA" => ["New York", "Los Angeles", "Chicago"], "Canada" => ["Toronto", "Montreal", "Vancouver"], "UK" => ["London", "Manchester", "Birmingham"] ]; // Get all cities in USA $usa_cities = $static_db["USA"]; // Get the first city in UK $uk_cities = $static_db["UK"][0];
$static_db = [ "Product 1" => 10.99, "Product 2" => 25.99, "Product 3" => 15.99 ]; // Get the price of Product 2 $product_2_price = $static_db["Product 2"];There are several PHP libraries available for working with static databases, including Flatbase, which provides a simple file-based database system for PHP applications. Alternatively, the built-in PHP functions for working with arrays can be used to implement a basic static database.