On Tuesday, November 04, 2003 8:12 AM Adam wrote: > I want to access a value of an array by key, but the array is not a > variable - it is a constant. > > How do I do it? > I tried > $value = PL_ORT[$key]; > , but this doesn't work (parse error)... > I even tried > $value = {PL_ORT[$key]};
Hi Adam. As per the manual, constants may only evaluate to scalar values. Are you sure what you're trying to do is even possible here? If you try to define a constant as an array, as follows: <?php define('something',array('foo','bar')); ?> the following error results: Warning: Constants may only evaluate to scalar values in c:\phpdev\www\constant.php on line 2. The valid types for use within constants are: - boolean - integer - floating-point number (float) - string Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php