This forum is now read-only. Please use our new forums! Go to forums
banner
Close banner
Why doesn't this work?
<?php
$name = "Jacynth";
print substr($name, rand(0, strlen($name) - 1), 1);
?>
I keeps saying “Your printed output from rand() should be an integer.”
Answer 552209a9d3292f6414000436
1 vote
if you’re talking about exercise 5/8, it’s because it’s asking for you to print a random number, then print a random number from your name.
you’re right, that code does work- you’ve just skipped step 1 of the exercise.
Answer 55228edf86f5525653000223
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
You have to echo $rand in the first block of PHP