Q: Does a colon : in an array key have any special significance?
From the manual:
An array can be created by the array() language construct. It takes as parameters any number of comma-separated key => value pairs.
array( key => value
, ...
)
While I was investigating what the Exception Object is set to, I created an error condition and put this line in-
print_r($ex);
Then in the web page produced looked at the source and it produces output like this-
Exception Object
(
[message:protected] => DB connection error: SQLSTATE[28000] [1045] Access denied for user 'test'@'localhost' (using password: YES)
[string:Exception:private] =>
Is the colon : in [message:protected] significant or is the key to the key => value pair literally message:protected ?
What you have there is
print_rs representation of the exception object’s properties. These aren’t accessible with array notation unless the class implements ArrayAccess and the property is public.As a further note, if you had an array like this…
… you can access the value as you normally would with
$array['my:key']