Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Michael Correale
Michael Correale
3,539 Points

Task 2 makes task 1 stop working, even though it should be fine

Ask a Question Challenge Task 2 of 2

The code is now displaying the right message. Thanks! Let’s change both variables to words that do start with R to make sure the code still displays the right message: change $var1 to Rocky Road and $var2 to Raspberry. <?php

$var1 = "Rockey Road";
$var2 = "Raspberry";
$initial = "R";

if (stripos($var1,$initial) === 0 && stripos($var2,$initial) === 0) {

    echo $var1 . " and " . $var2 . " both start with " . $initial . ".";

} else {

    echo "Either " . $var1 . " or " . $var2 . " doesn't start with " . $initial . "; maybe neither of them do.";

}

?>

Task 1 was corrected by changing the ==1 to ==0, but now when I enter the values for task 2 it stops working. I ran the code on my browser and they both outputted the correct values, but It keeps saying task 1 doesn't work anymore even though I've changed nothing. I Cant figure out whats wrong

1 Answer

If you change Rockey to Rocky it should work.