Categories
LAMP MySQL PHP

12 Essential PHP Interview Questions

 Our Toptal Engineering Blog has published a great post called “12 Essential PHP Interview Questions,” and I think it would be of interest to all of you.
See the preview of article given below :
Consider the following code:
$str1 = ‘yabadabadoo’;
$str2 = ‘yaba’;
if (strpos($str1,$str2)) {
echo “\”” . $str1 . “\” contains \”” . $str2 . “\””;
} else {
echo “\”” . $str1 . “\” does not contain \”” . $str2 . “\””;
}
The output will be:
“yabadabadoo” does not contain “yaba”
Why? How can this code be fixed to work correctly?
To see more goto : www.toptal.com/php/interview-questions