|
Posted by J.O. Aho on 12/01/06 07:29
insideview@gmail.com wrote:
> Hi, I've got this loop, and don't know how to express a variable:
>
> I have:
>
> <? $count=0; while($count<$total) { $string1 = ($some array stuff....
>
> Bascially, I want it to work this way
>
> <? $count=0; while($count<$total) { $string[$count] = ($some array
> stuff....
>
> so I there it would generate $string1, $string2, ... etc.... but this
> doesn't work since I am assigning it to AN ARRAY!
>
> I thought
>
> <? $count=0; while($count<$total) { $string . $count = ($some array
> stuff....
>
> But no go. How would I work this out? :)
>
You need to have an array,
$string=array(); //empty array with an empty first cell
after that you use
array_push($string,"what you want to insert into the array");
It's up to you what you want to push into the array, can be strings, arrays,
objects and so on.
See
http://www.php.net/manual/en/function.array.php
http://www.php.net/manual/en/function.array-push.php
//Aho
[Back to original message]
|