Hello Jasper and Rasmus, thanks for reply! I have found out why this does not work. Take a look below. On Monday 28 March 2005 02:33, Rasmus Lerdorf wrote: > Jasper Bryant-Greene wrote: > > Rasmus Lerdorf wrote: > >>>> Jasper Bryant-Greene wrote: > >>>>> You can't access string offsets with square brackets [] in PHP5. > >>>>> You need to use curly braces {} instead. I have replaced all square brackets with curly braces when using string offsets. This didn't helped but worked on PHP4 and 5. > > Yes, but he's talking about PHP5. He probably has E_STRICT on, which is > > why he's getting that error. > > > > I was telling him to use the correct syntax, which will cause him to not > > get that error. I have E_STRICT on but the same behaviour with E_STRICT off > I know we are talking about PHP5, and that syntax does not throw an > E_STRICT error. > Right!! Okay, lets see my original function again (copied from first post): function getNavigationContent($content_path) { Â Â $i = 0; Â Â $dir = opendir($content_path); Â Â while ($file = readdir ($dir)) Â Â{ Â Â Â Â if ($file != "." && $file != ".." && !in_array($file, explode(',', $this->arrConf['default_filtered_files']))) { Â Â Â Â Â Â $arrAvailableContent[$i] = $file; Â Â Â Â Â Â if(is_dir($content_path . $file)) { Â Â Â Â Â Â Â Â echo $n = 0; Â Â Â Â Â Â Â Â $subdir = opendir($content_path . $file); Â Â Â Â Â Â Â Â while ($subfile = readdir ($subdir)) Â{ Â Â Â Â Â Â Â Â Â Â if ($subfile != "." && $subfile != "..") { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* Â Â Â Â Â Â Â Â Â Â Â Â Â* This line does not work in PHP5 cause off an illegal string offset in an array ERROR Â Â Â Â Â Â Â Â Â Â Â Â Â*/ Â Â Â Â Â Â Â Â Â Â Â Â $arrAvailableContent[$i]['submenu'][$n]['file'] = $subfile; Â Â Â Â Â Â Â Â Â Â $n++; Â Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â closedir($subdir); Â Â Â Â Â Â } Â Â Â Â $i++; Â Â Â Â } Â Â } Â Â closedir($dir); Â Â return $arrAvailableContent; } In the code take a look at the following line: $arrAvailableContent[$i] = $file; I am assiging a string to the var $arrAvailableContent[$i] . Now lets take a look at the line i thought which was wrong: $arrAvailableContent[$i]['submenu'][$n]['file'] = $subfile; Now i am assigning a string to $arrAvailableContent[$i]['submenu'][$n]['file'] and this is what doesn't work. Now i have var_dump'ed all the arrays and i found out, that there are no values in $arrAvailableContent[$i]['submenu'] [$n]['file'] in PHP4. In PHP5 the script exits because of a Fatal Error. But if i set the line: $arrAvailableContent[$i] = $file; To: $arrAvailableContent[$i]['file'] = $file; Everything works fine in PHP4 and PHP5. My function now looks like this: function getNavigationContent($content_path) { Â Â $i = 0; Â Â $dir = opendir($content_path); Â Â while ($file = readdir ($dir)) Â Â{ Â Â Â Â if ($file != "." && $file != ".." && !in_array($file, explode(',', $this->arrConf['default_filtered_files']))) { Â Â Â Â Â Â $arrAvailableContent[$i]{'file'} = $file; Â Â Â Â Â Â if(is_dir($content_path . $file)) { Â Â Â Â Â Â Â Â echo $n = 0; Â Â Â Â Â Â Â Â $subdir = opendir($content_path . $file); Â Â Â Â Â Â Â Â while ($subfile = readdir ($subdir)) Â{ Â Â Â Â Â Â Â Â Â Â if ($subfile != "." && $subfile != "..") { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $arrAvailableContent[$i]{'submenu'}[$n]{'file'} = $subfile; Â Â Â Â Â Â Â Â Â Â $n++; Â Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â closedir($subdir); Â Â Â Â Â Â } Â Â Â Â $i++; Â Â Â Â } Â Â } Â Â closedir($dir); Â Â return $arrAvailableContent; } This works in PHP4 (4.3.10) and PHP5 (5.0.3)! Okay, after this my array doesn't look like the application wants it but this is because i never had this problem before and it should be fixed at all. I can change it quickly in my app since it is designed very clean but i just wanted you to know my conclusion. I have developed many lines of code in PHP4 in the last years but this weekend i gave PHP5 a try. I must say i am impressed. PHP4 really is missing some features but it is great too. Thanks Rasmus for inventing this scripting language. I will become a better PHP programmer just only with the new features in PHP5! Have a nice day! Regards -- # Johannes Findeisen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php