Is it Good this way


#1


https://www.codecademy.com/courses/web-beginner-en-7I7Xm/0/5?curriculum_id=5124ef4c78d510dd89003eb8#


no error just asking if it is good my inputs


<html>
    <p>
    <?php
    // Use rand() to print a random number to the screen
    print rand();
    ?>
    </p>
    <p>
    <?php
    // Use your knowledge of strlen(), substr(), and rand() to
    // print a random character from your name to the screen.
    $name = "Mike";
    $nameLength = strlen($name) - 1;
    $atLast = substr($name,rand(0,$nameLength));
    print $atLast;
    ?>
    </p>
</html>


#2

I think is not correct because sometimes it output 3 characters or more.
And.. I can't figure out how to strictly output only 1 char...
It's just about how codecademy interpreter renders..
It's just a matter of luck.


#3

And I founded the solution by fallback on previous checkpoint

<html>
    <p>
    <?php
    // Use rand() to print a random number to the screen
    print rand();
    ?>
    </p>
    <p>
    <?php
    // Use your knowledge of strlen(), substr(), and rand() to
    // print a random character from your name to the screen.
    $name = "Mike";
    $nameLength = strlen($name) - 1;
    $atLast = substr($name,rand(0,$nameLength),1);
    print $atLast;
    ?>
    </p>
</html>

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.