thepip3r Posted February 12, 2007 Share Posted February 12, 2007 I'm designing a menu system for my site and started building a multidimensional array like I always have; I went over and over this and don't think there's any syntax errors < PHP 5.whoKnows. Here is what it looks like: $menuArr['home'] = "<div $onMouseEvents><a href=\"index.php?a=middle\">» Home</a></div>"; $menuArr['projects'] = "<div $onMouseEvents><a href=\"index.php?m=projects;\">» Projects</a></div>"; $menuArr['resume'] = "<div $onMouseEvents><a href=\"resume.mht\" target=\"_new\">» Resume</a></div>"; $menuArr['projects']['kix'] = "<div $onMouseEvents1><a href=\"index.php?m=projects;kix;\">» KiX</a></div>"; $menuArr['projects']['hta'] = "<div $onMouseEvents1><a href=\"index.php?m=projects;hta;\">» HTAs</a></div>"; $menuArr['projects']['php'] = "<div $onMouseEvents1><a href=\"index.php?m=projects;php;\">» PHP</a></div>"; $menuArr['projects']['vbs'] = "<div $onMouseEvents1><a href=\"index.php?m=projects;vbs;\">» VBScript</a></div>"; $menuArr['projects']['php']['nsconv'] = "<div $onMouseEvents2><a href=\"index.php?m=projects;php;&p=php;nsconv\">» Number System Converter</a></div>"; $menuArr['projects']['php']['randpwgen'] = "<div $onMouseEvents2><a href=\"index.php?m=projects;php;&p=php;randpwgen\">» Random Password Generator</a></div>"; $menuArr['projects']['php']['asciigen'] = "<div $onMouseEvents2><a href=\"index.php?m=projects;php;&p=php;asciigen\">» ASCII Character Generator</a></div>"; $menuArr['projects']['php']['hexcolor'] = "<div $onMouseEvents2><a href=\"index.php?m=projects;php;&p=php;hexcolor\">» Hex Color Chart</a></div>"; When I refreshed my page, I got an error stating: Fatal Error: cannot use string offset as an array in .... After commenting my code vigorously to try and find the syntax error I thought I had, I decided to search the almighty Google and came up with this bug report off of Zend which is apparently no bug at all. The commentary finally links us back to the PHP website for backwards incompatability for PHP 4 -> 5, 3rd bullet. After reading this I wanted to choke myself. One of the main reasons I LOVE PHP is because of it's awesome ease with working with arrays. And if this associative multidimensional array building no longer works, I have two questions. 1. Why would they make it that way? ...essentially they made an incredibly simple way to build multidimensional arrays and obfuscated the whole process. 2. How do we now make multi-dim assoc. arrays so that they turn out the way they used to in PHP4?? e.g. Array ( [.idleTime] => 1171284896 [.loggedIn] => 1171284896 [user] => Array ( [user_id] => 1 [username] => thepip3r [email] => [email protected] [sex] => ? [city] => ?? [state] => ?? [country] => ?? [created] => 1162412158 [lastlogon] => 1170776664 ) [char] => Array ( ....... ) ) Link to comment https://forums.phpfreaks.com/topic/38159-one-for-the-gurus-php5-multidimensional-associative-array-functionality-loss/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.