Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Enhancing a Simple PHP Application Adding Search: Model Using stripos: Starts with C

struck on CC Task 2


$var1 = "Cookie Dough";
$var2 = "chocolate";
$initial = "C";

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

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

} else {

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



1 Answer

Thats easy, take a look at this links, there you will se the answer: http://www.php.net/manual/en/language.operators.comparison.php