Can anyone help me with a solution that pulls the position and value of a random character from a given string using PHP. For example I have a a string variable $string = \
Using mt_rand(),
You can get the index of a random character by:
$charIndex = mt_rand(0, strlen($string)-1); $char = $string[$charIndex]; // or substr($string, $charIndex, 1)