# Help me out in this one ^^

#1

Math Functions II

Well this is the outcome i got :
6
r
and this is the error :
This is my code :

``````    print rand(1,9)."<br>";
\$len = strlen( \$name ) - 1;
\$rand = rand( -1 , \$len);
print substr( \$name , \$rand , \$rand );``````

Help me out to find the error

#2

``    \$rand = rand(0, \$len - 1);``

?

``    print substr(\$name, \$rand, 1);``

#3

Didnt work
I don't know the problem, The compiler shows 1 number and 1 letter, Yet i still get the error..

#4

I don't know what I was thinking, you already subtracted one from the length. What happens when you write,

``\$rand = rand(0, \$len)``

There are two segments in the provided setup:

``````    <p>
<?php
// Use rand() to print a random number to the screen
print rand(1,10);
?>
</p>

<p>
<?php
// Use your knowledge of strlen(), substr(), and rand() to
// print a random character from your name to the screen.
print substr("Weegillis",rand(0,strlen("Weegillis")-1),1);
?>
</p>``````

Yours pretty much matches this. codewise, but it may be necessary to keep the provided structure..