Web Tool Bag  
Home · Articles · Downloads · Discussion Forum · Web Links · News CategoriesFebruary 05 2012 11:42:47
Navigation
Home
Articles
Downloads
Discussion Forum
Web Links
News Categories
Search
Users Online
Guests Online: 3
No Members Online

Registered Members: 625
Newest Member: nownigcheencex43
Forum Threads
Newest Threads
reverse mortgage
Science channels in ...
How can I see the fu...
Order Flagyl Without...
X-Rumer 7.0 - best s...
Hottest Threads
Installation [11]
Hermoine nude [6]
Captcha picture d... [6]
Integrate with Vi... [5]
Any questions and... [5]
Trusted web hosting

Coupon Code
WEBTOOLBAG
Latest Articles
jQuery Accordion - m...
Few Guidelines for W...
Move OST to PST to U...
Microsoft OST vs. Mi...
Tips for Specialized...
Fatal error: Cannot use string offset as an array PHP5 PHP4

OsCommerce - Fatal error: Cannot use string offset as an array in /catalog/admin/includes/classes/table_block.php


PHP5 Error message that is caused by attempting to assign a value to an array element of a variable that is declared as a string.

Example that generates error:
$foo=’bar’;
$foo[0]=’bar’;
Get error message Fatal error: Cannot use string offset as an array in …

Explanation
$foo was declared as a string in $foo=’bar’.
$foo[0] is trying to append an element onto a string variable.

Example that does not generate error:
$foo[0]=’bar’;
$foo=’bar’;
Does NOT generate error.

Explanation
$foo[0]=’bar’ instantiates variable $foo as array since it has not been instantiated. Then assigns ‘bar’ to element $foo[0].
$foo=’bar’ implicitly re-declares $foo as a string and assigns ‘bar’ to it.

Example that does not generate error:
$foo=’bar’;
$foo=array();
$foo[0]=’bar’;

Explanation
$foo=’bar’ implicitly declares $foo as a string variable then assigns ‘bar’ as the value.
$foo=array() explicitly re-declares $foo as an array.
$foo[0]=’bar’ can now be executed as $foo is declared as an array.


Posted by zdravko on August 19 2008 15:04:30 1410 Reads · Print
Ratings
Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Member Poll
Which PHP framework do you preffer?

Symfony

Zend

PHPDevShell

PHP on TRAX

eZ Components

Fusebox

PhpOpenbiz

Prado

QPHP

Seagull

You must login to vote.
Shoutbox
You must login to post a message.

Vince
03/10/2011 18:17
Hi, How to remove Register from Login screen? I don't want them to register and have full access! if you leave register then they should not have any rights until the admin assigns them

webtoolz
26/09/2011 08:28
Please describe your problem with more details. Thank you.

bimmer98
22/11/2010 18:31
Help. There was a problem with the request; error regarding feedbackzdr form program

PHP Obfuscator
Copyright © 2012 - www.webtoolbag.com