No Force Object To String

../_images/no_force_object_to_string.png

PHP automatically converts numeric strings to integers when used as array indices, so ‘123’ becomes 123 (the integer). However, PHP doesn’t perform similar conversions for objects, when they are used as array keys. Instead, it immediately throws a fatal Illegal offset type error because objects are not automatically converted to valid array keys.

See Also

PHP Error Messages

PHP Features