Illegal string offset is nothing but warning when using the $obj[‘type’] means the function is only passing the string it is not applicable for numerical values.