#### Archived

This topic is now archived and is closed to further replies.

## Recommended Posts

Let's say I have this,
[code]\$type1 = '5'; // all the values are in %
\$type2 = 15'';
\$type3 = 20'';
\$type4 = 50'';
\$type5 = 10'';[/code]

Is it possible to assign them to
\$type1_result = '11111';
\$type2_result = '222222222222222';
\$type3_result = '33333333333333333333';
\$type4_result = '44444444444444444444444444444444444444444444444444';
\$type5_resul = '5555555555';

Hope you understand what I'm trying to say..

##### Share on other sites
[quote]Hope you understand what I'm trying to say..[/quote]

Nope... sorry.

##### Share on other sites
Hmm ok, I will explain again..
If I put \$A = 10;
Then I had another var, which is what I couldn't figure out myself.
Let's say that var is \$A_Result, then I want the vaule of \$A_Result to be AAAAAAAAAA. (There are 10's A)

So the value of \$A_Result is depended on the value of \$A.
Hmm.. Is this clear ?

To make it more clearer, this is the code I'm using now.
[code]    function rtd(\$length)
{
\$dice1 = '5'; // Dice 1
\$dice2 = '15'; // Dice 2
\$dice3 = '20'; // Dice 3
\$dice4 = '50'; // Dice 4
\$dice5 = '10'; // Dice 5
\$dice6 = '0'; // Dice 6

\$chars = \$dice1 . \$dice2 . \$dice3 . \$dice4 . \$dice5 . \$dice6;
for (\$x = 1; \$x <= \$length; \$x++)
{
\$number = rand(1, strlen(\$chars));
\$dice .= substr(\$chars, \$number - 1, 1);
}

return \$dice;
}[/code]

Then when I echo out \$dice, there's 5% will be Dice 1, 15% to be Dice 2, 20% to be Dice 3, 50% to be Dice 4, 10% to be Dice 5 and 0% to be Dice 6

##### Share on other sites
[code]
for(\$count=0;\$count<10;\$count++)
{
\$result.=\$a;
}
[/code]

##### Share on other sites
[code]<?php

for (\$A = 1; \$A <= 10; ++\$A)  //Display 10 of the following
{
echo 'A '; //10 What? 10 A's!
}
?>[/code]

##### Share on other sites
Still a bit lost. Something like....

[code=php:0]
<?php

\$a = 10;
\$a_result = 'a';

?>
[/code]

Maybe the question I should ask is why? What exactly are you trying to do?

##### Share on other sites
Just updated my previous post, hope it is clear enough.
Ok sorry, I got to work. I will read it again after I return home.

And thanks for all your helps.

##### Share on other sites
Ok, I'm back from work.
Hey fert, thanks for enlighten me.
\$result[b].[/b]=\$a;

And thanks for all your helps again. Cheers :)