They want you to
string substr ( string $string , int $start [, int $length ] ) ^ ^ ^ ^ ^ ^ $name ^ 1 ^ int rand ( int $min , int $max ) ^ ^ ^ ^ 0 (strlen( $name ) -1)
you can refer to my code..i thing i work..hihi
// Use rand() to print a random number to the screen
// Use your knowledge of strlen(), substr(), and rand() to
// print a random character from your name to the screen.
omg your are a genus you helped me thank you!!!!
You're pretty close! You don't need to print every function that you have learned from the lesson. This is the code I used:
$name = "Jonathan"; //Determine the string length of your name $length = strlen($name); //Determine a random number between 0 and the lenght of your name $rand = rand(0, $length); //Use substr to pick a random character. The three parameters passed for substr //Are String(your name), Starting point(We want this to be random), and how many //Characters we want listed(1) $randChar = substr($name, $rand, 1); echo $randChar;
Hope this helps!! Don't give up and happy coding
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.