No Force Object To String¶
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¶
Cast to object as key [Try me]