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 = \
Code:
$string = 'helloworld'; $position = rand(0, strlen($string)); $character = $string[$position-1]; echo $character . ' is placed ' . $position . ' in the following string: ' . $string;
Output Example:
e is placed 2 in the following string: helloworld
CodePad Demo