We will start with your "for" loop:
for ($ii = 1; $ii <= 1000; $ii++) {
becomes:
for($ii = 1000; --$ii > 0😉
that will make your "for" loop faster, as comparing to zero is much faster than "<= 1000".
2nd:
You here use array_push to add the element to the end of the array:
array_push($words, chr(rand(1,26)+65).....);
I'm not sure if this is true, but I would think that 1000 function calls must be slower than 1000:
$words[] = chr(rand(1,26)+65).....;
This does the same thing without the 1000 function calls.
3rd:
chr(rand(1,26)+65)
I'm sure adding 65 to a number doesn't take long, but why not use chr(rand(66,91))? The 2 params to rand are a min and a max so the outcome will be identical.
In programming terms "rand(1, 26)+65" == "rand(66, 91)" 😉
Hope this helps,
Jack