Skip to content

Latest commit

History

History
28 lines (23 loc) 路 647 Bytes

File metadata and controls

28 lines (23 loc) 路 647 Bytes

The strpos() function is used to determine the position in a string of the given search string. If the search string cannot be found, false is returned. What is the output of the following script?

$haystack聽=聽'abcda';
$needle聽聽聽=聽'a';
$pos聽=聽strpos($haystack,聽$needle);

if聽(!$pos)聽{
    echo"miss";
} else聽{
聽聽聽聽echo"hit聽"聽.聽$pos;
}

Enter the exact script output

  • A) miss
  • B) hit3
  • C) hit0
  • D) hit1
Answer

Answer: A