Reply to Re: Question

Your name:

Reply:


Posted by Craig Taylor on 01/12/07 03:31

alka...@gmail.com wrote:
> Hi, can someone please show me how to assign a standard $var, to the
> contents of a for loop like,
>
> for ($a=0; $a<10; $a++){ $array[$a]; }
>
> :)
>
> so, I wanted something like
>
> $var = for ($a=0; $a<10; $a++){ $array[$a]; }
>
> but it doesn't work. thanks for a push in the right direction! :)

Not quite sure what you're trying to do but one of the following 2
probably fit the bill:

To assign a value ($val) to each element in the array:

for( $a=0; $a<10; $a++) { $array[$a] = $val; }

To assign an array containing the digits 0-9 to $val do the following:
$val = array();
for( $a = 0; $a<10; $a++) { $val[] = $a; }

Hope 1 of these help...

- Craig Taylor
http://www.ctalkobt.net

[Back to original 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

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