This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Functions, Part I Forum

View Course » View Exercise

204 points
89a1259dd360f948a9647fce6285c2be?s=140&d=retro
Submitted by
annewamuyu
over 2 years ago

please help review this code. the random output you printed from your name should be a lettter

$name = "Wamuyu";
$length = strlen ( $name);
print $length;
$partial = substr( $name , 0 , 4);
print $partial;
$character = rand(0,strlen($name)-1);
$letter = substr($name,$character,1);
print $letter;
?>


0 votes

permalink

have you solved it yet? i am having the same problem.

1096 points
586e0c859ad7f5e1c7000392_545033831
Submitted by
Muse
over 2 years ago

1 Comment

7c79f4bc91e4868f940dd8c5ddd59927?s=140&d=retro Angela Shaw over 2 years ago

using echo before your strpos statement will produce the numerical statement that the exercise is expecting.
//example
echo strpos("work dammit","m");


0 votes

permalink

echo strpos("work dammit","m");

438 points
7c79f4bc91e4868f940dd8c5ddd59927?s=140&d=retro
Submitted by
Angela Shaw
over 2 years ago