I cannot figure out how to fix my code someone please please help me


// Print out the position of a letter that is in
// your own name
strpos( "Gabe", "0");

// Check for a false value of a letter that is not
// in your own name and print out an error message
if (strpos("Gabe" , "0") === false) {
print "There is no 0 in Gabe";


// Print out the position of a letter that is in
// your own name
strpos( "Gabe", "0");

Here you need to output a number. So, let's say you want to find the position of b within Gabe, you need to output the position of b.


how would i do that? I tried figuring it out for a couple of hours and havent figured it out


What you could do is create a variable, and assign what you currently have to this variable.

You would then simply print the variable. I think that is simple enough.

But you'll also have to modify your current code a bit, like this

strpos("Gabe", "b");

(that is, if you want to know the position of b. Could be any other letter!) :wink:


that took me beyond too long thank you!


The strpos () method returns the position of a substring within the input-string. If the substring is not found, then the result is false.
you could do it like this:
$name = "Denny"; //assign the input-string to a variable
strpos($name, "e"); // return's true
strpos($name, "r"); return's false


thank you! i for some reason could just not figure this out and its ridiculous but thank you so much


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