Multiple choice php

What will the following script output?

$array = '0123456789ABCDEFG';
  $s = '';
  for ($i = 1; $i < 50; $i++) {
     $s .= $array[rand(0,strlen ($array) - 1)];
  }

echo $s;

  1. A string of 50 random characters

  2. A string of 49 copies of the same character, because the random number generator

  3. A string of 49 random characters

  4. has not been initialized

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The loop runs from $i = 1 to $i < 50, which results in exactly 49 iterations. In each iteration, one random character from the '$array' string is appended to '$s'. Therefore, the final string '$s' contains 49 random characters.