Created
August 11, 2014 08:30
-
-
Save JacobHsu/863c3f2c0e44a767abac to your computer and use it in GitHub Desktop.
#php : strlen(string), rand(min, max), and substr(string, start, length)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<p> | |
<?php | |
// Use rand() to print a random number to the screen | |
echo rand(); | |
?> | |
</p> | |
<p> | |
<?php | |
// Use your knowledge of strlen(), substr(), and rand() to | |
// print a random character from your name to the screen. | |
$name = "jacob"; | |
echo substr($name ,0, rand( 0, strlen($name)- 1) ); | |
?> | |
</p> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment