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

Functions, Part I Forum

View Course » View Exercise

260 points
Picture
Submitted by
Deborah Thomas
over 2 years ago

3 -8 will not proceed to next question even though I got the code correct

<?php
// Print out the position of a letter that is in
//your name
$posLett = strpos("Deborah", "r");
print $posLett;
?>


<?php
// Check for a false value of a letter that is not
// in your own name and print out an error message
if (strpos("Deborah", "r") === false){
print "Sorry, no 'r' in 'Deborah'";
}
?>


0 votes

permalink

Finally got this to work, using Opera, and not Safari.

260 points
Picture
Submitted by
Deborah Thomas
over 2 years ago

2 Comments

563d2fb3b625480293000507_11881638 EricGiannini over 2 years ago

Did you try in Chrome or Firefox?

54d7878fe39efe8c7a001863_756191777 MananC07 about 2 years ago

I Dnt Get It Why Use Safari Or Opera , USe Chrome And Firefox Best For Coders


0 votes

permalink

What is wrong? (3/8)
My code:

<?php
strpos("natalia", "aui");
?>


<?php
if (strpos("natalia","f") === false){
echo 'net';
}
else {
echo 'yes';

}
?>

Oops, try again. Your first strpos() call should output a number.

63 points
10372c57e0210b0198d86ae45dcc3703?s=140&d=retro
Submitted by
natali.kychirenko
over 2 years ago

2 Comments

54cffb8c51b887b5bb0011aa_557477897 Ali over 2 years ago

give your strpos a variable then print it

Picture Theo Arefb about 2 years ago

print strpos("natalia", "ali"); //print some letter from the word "natalia" - that's the task


0 votes

permalink

This one worked for me !
Is just at my Browser, or this PHP course is full of bugs ?

<?php
$Name = "Levo";
$pos = strpos("Levo", "v");
echo $pos;

?>
</p>
<p>
<?php
$myName = "David";
$fl = "r";
if(strpos("$myName", "$fl") === false){
    print "ERROR FAILED";
    }


?>

1381 points
55ccf28393767669ba00004f_108262555
Submitted by
MarokonKongo
almost 2 years ago