thesonix thesonix - 2 months ago 7x
PHP Question

Illegal string offset Warning PHP

I get a strange PHP error after updating my php version to 5.4.0-3.

I have this array:

[host] =>
[port] => 11211

When I try to access it like this I get strange warnings

print $memcachedConfig['host'];
print $memcachedConfig['port'];

Warning: Illegal string offset 'host' in ....
Warning: Illegal string offset 'port' in ...

I really don't want to just edit my php.ini and re-set the error level.

Thanks for any help!


Please try this way.... I have tested this code.... It works....

$memcachedConfig = array("host" => "","port" => "11211");
print_r ($memcachedConfig['host']);