Needle/Haystack problem


#1



Unit 7 excercise 3


I have no idea what is wrong with this code as I copied the example very precisely... Can anybody tell me what is wrong here?


<html>
    <p>
    <?php
    // Print out the position of a letter that is in
    // your own name
    strpos("oscar", "a");
    if  (strpos ("oscar","b")===false) {print "error";}
    ?>
    </p>
    <p>
    <?php
    // Check for a false value of a letter that is not
    // in your own name and print out an error message
    
    ?>
    </p>
</html>


#2

Hi first you shoudl add echo like that to this line

echo strpos("oscar", "a");

then put your code like tthat

<html>
    <p>
    <?php
    // Print out the position of a letter that is in
    // your own name
    echo strpos("oscar", "a");

    ?>
    </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 ("oscar","b")===false) {print "error";}
    ?>
    </p>
</html>

so that it will print the number and the string each on his line.


#3

Hi!! Thanks this helped me so much... greets