PHP strpos interview question

$str = ‘abcdef’;

if(strpos($str, ‘a’))
{
echo “founct the letter ‘a'”;
}
else
{
echo “could not find the letter ‘a'”;
}

Let trace it,  strpos return position of str in intergers and first letter will be at postion 0, so in ‘abcdef’ a is at postion zero and if condition consider it false, so

out will “could not find the letter a”.

PHP Increment, Decrement and output

What is the output?

$a=1;
++$a;
$a *= $a;
echo $a–;

Let track it,

a = 1

a become 2 in step 2, than 2*2=4, than the trick comes

first echo will work and on screen output will be 4 and than decrement will work. so

Output will be 4.