Hello folks,

I just updated my homeserver to PHP 5.3.1 and I get now the following error when executing my scripts:

Cannot use string offset as an array

The variable looks like: $bes[$a[3]][$a[4]][$a[6]], where $bes is a three-dimensional array that holds all information I need during runtime. The $a's can basically hold the information about a location, a day and an hour. So after runtime I have a nice smooth table of all information I need for a place and a time.

So the problem is, that the main variable causes the problem. Replacing it with something new means to rewrite the whole code. And this is as you know awful work and costs quite a few bucks.

The old server (online): Apache 2.0.54 / PHP 4.3.10-22 (Debian, I guess)
My new home server: Apache 2.2.14 / PHP 5.3.1 (opensuse 11.2)

So has anyone experiences with reorganisation of old PHP-4-code? I tried to use intval() to make all possible strings to ints but that doesn't seem to do the trick.

Any help is much appreciated!

$bes is a three-dimensional array My bet is that isn't the case, var_dump($bes); before that to see what $bes actually is. That error happens when you try to do something like this.

$some_string = "Hello";
echo $some_string[0][1]; // PHP Fatal error: Cannot use string offset as an array

Hi ShawnCplus:

you could be right. But how do I crate an array then? Trying to define it with


doesn't work either.


Show the code you have right now