I’m creating a php script which creates a random number which is 7 digits long and doesn’t contain 0’s, the only problem with this is that I have to call the function rand 7 times and store every number generated in a different variable, but I was wondering how I could put these numbers together in a variable instead of adding them together
something along the lines of
$security_number = $1&&$2&&$3 and so on.
thanks in advance.
I think I know what you are trying to achieve. You need the mindset that you actually want a seven character string of digits. For example, if your number was 0028172, if it is stored as a number then just like a digital calculator it will be displayed as 28172 unless you use string formatting.
If you already have code creating the individual digits, simply use concatenation:
$securitycode = $digit1 . $digit2 . $digit3 . $digit4 . $digit5 . $digit6 . $digit7;
Hopefully this helps you.