You are here: Re: Start array key at 1 « PHP Programming Language « IT news, forums, messages
Re: Start array key at 1

Posted by Thomas Hamacher on 10/30/07 14:28

Chris schrieb:
> How can I change the following snippet to have the array key start at
> 1 and not 0?

You could unshift the array and then delete the new item immediately,
but this ugly and makes no sense, since you can work with your array
without transformation.

array_unshift($periods);
unset($periods[0]);

[...]

> // Periods
> for ($periods=1;$periods <=$num_periods;$periods++) {
> $eachperiod = $weekdays*$num_periods+$periods;

for($periods = 0; $periods < $num_periods; $periods++) {
$eachperiod = $weekdays * $num_periods + $periods + 1;
}

 

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

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