Random number draw
PHP Code:
|
PHP Code:
|
Quote:
PHP Code:
I'm not too familiar with random integer scripts but of what I know that's not right because the only number between 1 and 3 is 2. I need it to only pick from 1 or 3. |
Quote:
random(1,3) gives you a random number between 1 and 3 (though never the high number, in this case 3.) So for example, random(1,3) might give you 2.5, or 1.72, etc. int() then rounds the number down to the nearest integer. (so 2.5 becomes 2, 1.99 becomes 1.) So PHP Code:
|
Quote:
PHP Code:
|
Quote:
|
heres my input :P
PHP Code:
|
Those are some of the most weirdly complicated ways of doing this I've seen.
PHP Code:
|
PHP Code:
Edit: For more information on the ternary operator. http://en.wikipedia.org/wiki/Ternary_operator |
Quote:
|
Quote:
|
@scriptless,
Its all about readability and efficiency. |
Quote:
|
Quote:
I figured it out! And sorry, I'm really trying to learn. |
Quote:
|
All times are GMT +2. The time now is 12:09 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.