"Black S." wrote:
>
> Basically I have array variables, lets say:
> -------------------------------------------
> $folder[0] = "basic";
> $folder[1] = "standard";
> $folder[2] = "knowledge";
>
> Fruther down in the code:
> -------------------------------------------
> $totalsub_basic = "10";
> $totalsub_standard = "24";
> $totalsub_knowledge = "12";
>
> Everything runs fine until "$total_count" how do I take the value of
> $folder[$i], lets say "standard" append that to "totalsub" and get the value
> of "$totalsub_standard"?????
> -------------------------------------------
> $i = 0;
> while($i < $level_0_links) {
> echo "First While Loop";
>
> if (ereg("^/$folder[$i]?", $PHP_SELF)) {
> $a = 0;
> $total_count = (eval("$totalsub_$folder[$i]")); <-------
> while ($a < $total_count) {
> echo "$a";
> $i++;
> }
> }
>
> $i++;
> }
>
> Thanks Everyone!
>
Why not use some hash io separate variables? And, eh, why do you
quote integer values? What I would suggest is something like this:
/* Just as you already had.... */
$folder[0] = "basic";
$folder[1] = "standard";
$folder[2] = "knowledge";
/* -- HASH -- */
$totalsub{"basic"} = 10;
$totalsub{"standard"} = 24;
$totalsub{"knowledge"} = 12;
In this way it's easy to access the totalsub-values:
e.g.: $totalsub{$folder[0]}
--
* R&zE:
***************************
** Renze Munnik
**
** E: [EMAIL PROTECTED]
** M: +31 6 218 111 43
***************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]