Avatar ·

Can you store arrays in constants in PHP? Problem with define() and const

Hello everyone! I'm a beginner PHP developer and I'm having a problem with constants. I need to create a constant that will contain an array with database connection settings and a list of allowed IP addresses. Previously I used `define()` for simple strings and numbers, and everything worked fine. But when I tried to pass an array to `define()`, PHP gave an error: "Constants may only evaluate to scalar values or arrays". I tried two approaches: 1. Using `define()`: ```php define('DB_CONFIG', [ 'host' => 'localhost', 'port' => 3306, 'user' => 'admin', 'pass' => 'secret' ]); // Error: Constants may only evaluate to scalar values ``` 2. Using the `const` keyword: ```php class Config { const ALLOWED_IPS = ['192.168.1.1', '10.0.0.1', '127.0.0