Jörg Reinholz: Sortierproblem

Beitrag lesen

Warning: Illegal string offset 'childs' in xxxxxxxxxxxxxxxxxx   on line 42

Ich ein Problem darin, dass in der Zeile
$items[$row['id']] = $row['name'];
an eines der Elemente bereits ein Wert (string) vergeben wird.

So ist es auch:

test.php:

<?php  
$items[0]='bar';  
$items[1] = 'foo';  
$items[1]['childs'][0] =& $items[0];  

Ausführen ... und:

PHP Warning:  Illegal string offset 'childs' in /tmp/test.php on line 4

Warning: Illegal string offset 'childs' in /tmp/test.php on line 4
PHP Fatal error:  Cannot use string offset as an array in /tmp/test.php on line 4

Fatal error: Cannot use string offset as an array in /tmp/test.php on line 4

Jörg Reinholz