You are here: Re: Uninitialized string offset « PHP Language « IT news, forums, messages
Re: Uninitialized string offset

Posted by ZeldorBlat on 05/03/07 15:51

On May 3, 11:29 am, misiek <michal_augustyn...@gazeta.pl> wrote:
> Not sure what causes this errro..!
>
> $this->text = 'w';
> $i = 0;
> $token = '';
>
> while ($this->text{$i} != null) // <= Line #37
> {
> // some code
> $i++;
> }
>
> Uninitialized string offset: 1 in
> /home/misiek/workspace/emailpower/app/models/text_construct.php on line 37
>
> Use PHP 5.2
>
> Thanks for help

You get that error because the string only has 1 character (at index
0) so there is no character at index 1. Try this instead:

while($i < strlen($this->text)) {
//some code
$i++;
}

 

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

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