I'm newer to PHP 8. I'm working in code where there are a number of 'constant' mappings. They are done using a static array in various classe. Example:
public static $mapNamedIds = array(
"NamedItem1" => 1234,
"NamedItem2" => 2345,
"NamedItem3" => 3456,
);
Is there a reason it should not be implemented like this? Example:
public const NAMED_IDS_MAP = array(
"NamedItem1" => 1234,
"NamedItem2" => 2345,
"NamedItem3" => 3456,
);
Is there a reason why static would be better than using a const array? Other than the 'const' actually being constant. Is there a performance benefit of const over static? Again these are typically defined in classes and are not globals...