I need help with number 3


#1

whats wrong with my code it says it must output a number



<?php
// Print out the position of a letter that is in
// your own name
if (strpos("Tobias","b") === false) {
print "sorry no 'b'in 'Tobias'";
}
?>



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


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


#2

Try this

<?php
	// Print out the position of a letter that is in
	// your own name
	print strpos("Tobias","b");
	print "<br><br>";
?>


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

They just want you to make sure the first call in strpos() is a number. So all you have to do is look for the index of a character in your target string


#3

Hi Ryan, i copied your code and it gives me this message:

"Oops, try again. You should print out a useful error message for the failed strpos() call."

Do you know what to do?


#4

Try this,good luck

<html>
<p>
<?php
// Print out the position of a letter that is in
// your own name
$myName="Vitnere";
$myLet="t";
$name=strpos($myName,$myLet);
echo $name;
?>
</p>
<p>
<?php
// Check for a false value of a letter that is not
// in your own name and print out an error message
if (strpos($myName,"Z")===false){
    echo "Hey nigga there is no that letter in that string.Cherio";
    }

?>
</p>


#5

this worked for me:



<?php
// Print out the position of a letter that is in
// your own name
strpos("daphne", "h"); // 3
print strpos();
?>



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



#6

thank you lol, loved the code too