you may want to check out this tutorial on strings :
http://www.zend.com/zend/tut/using-strings.php
also, just a fyi, you can use ternery operator like so :
echo ($foo == 'bar') ? 'yes it is' : 'nope';
which is the same as :
if ($foo == 'bar') {
echo 'yes it is';
} else {
echo 'nope';
}
and regarding control-structure syntax such as if/else statements, check out :
http://php.net/manual/en/control-structures.php