<html> <p> <?php print rand(); ?> </p> <p> <?php $name = "AliAmaim"; $num = rand(0,7); print substr($name, $num, $num); ?> </p> </html> What's wrong with this? it prints out more than one letter.
why is there $num twice?
Hey, this is the code that worked for me:
$name = 'Ashwin';
echo substr($name, rand(0, strlen($name) - 1), 1);
Hope this helped!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.