You are here: Re: "Array to String Conversion" error when constructing a multi-dimensional array « PHP Programming Language « IT news, forums, messages
Re: "Array to String Conversion" error when constructing a multi-dimensional array

Posted by Rik on 01/18/07 17:44

drako wrote:
> drako wrote:
>> You are correct in assuming that I chopped out a line when I posted
>> this...
>>
>> The missing line between '$x=0' and
>> '$_SESSION["increment"][$x]=array(...)'.
>>
>> is
>>
>> if(isset($_SESSION["increments"])) {$x =
>> count($_SESSION["increments"]);}
>>
>> The purpose is to count the number of entries in the array - if count
>> returns '5', then the last value of $x would have been 4, so we can
>> assign '5' as the next value in the array.
>>
>> Could this be the offending line...
> Sorry, the extra line of code above should have read:
>
> if(isset($_SESSION["increment"])) {$x =
> count($_SESSION["increment"]);}
>
> I just noticed the typo, in case anyone has been sharp enough to spot
> it...

But that's not it afaik. See the comment about just using empty [], this
will just add an array-value to the end.

However, there's something else going on in the adding. Posting the total
code that works on $_SESSION["increment"] woudl speed up the process :-).

You probably have a $_SESSION["increment"] = something(); somehere, where
the function just returns true instead of a processed array, casting it to
the '1' string.
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация