You are invited to Log in or Register a free Frihost Account!

# IP Generation

fromegame
Hello Again

I need a script that generates max. 12 random numbers.

x = generated number

xxx.xxx.xxx.xxx

But if x = 0 then it must not be showed, so if x = 0 and y != 0

(x)yy.yyy.yyy.yyy

Thank You
DanielXP
PHP.net rand()
fromegame
Yes I know, but how can I get all those rands in 1 variable?
hexkid
 fromegame wrote: how can I get all those rands in 1 variable?

With the concatenation operator
 Code: \$var1 = rand(); \$var2 = rand(); \$var3 = rand(); \$x = \$var1 . '.' . \$var2 . '.' . \$var3; \$y = "\$var1.\$var2.\$var3";
snowboardalliance
hexkid wrote:
 fromegame wrote: how can I get all those rands in 1 variable?

With the concatenation operator
 Code: \$var1 = rand(); \$var2 = rand(); \$var3 = rand(); \$x = \$var1 . '.' . \$var2 . '.' . \$var3; \$y = "\$var1.\$var2.\$var3";

 Code: \$var1 = rand(0,999); \$var2 = rand(0,999); \$var3 = rand(0,999); \$var4 = rand(0,999); \$x = \$var1 . '.' . \$var2 . '.' . \$var3 . '.' . \$var4; \$y = "\$var1.\$var2.\$var3.\$var4";

Will work if you want three digits max (i.e. "234.555.8.14")
Or change the 0,999 to whatever values.