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!
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
MUZ140610 Tinashe Marunda
7,028 PointsI have this block of code that isn’t working correctly, but I can’t figure out the problem. It says that Broccoli and Cr
help
<?php
$var1 = "Broccoli";
$var2 = "Cream Soda";
$initial = "R";
if (stripos($var1,$initial) == 1 && stripos($var2,$initial) == 1) {
echo $var1 . " and " . $var2 . " both start with " . $initial . ".";
} else {
echo "Either " . $var1 . " or " . $var2 . " doesn't start with " . $initial . "; maybe neither of them do.";
}
?>
1 Answer

Gabriele Venturini
3,313 PointsI think u need replace:
$initial = "R";
with:
$initial = "r";