Home »
MCQs »
PHP MCQs
What will be the output of the following PHP code (28)?
129. What will be the output of the following PHP code?
<?php
$str = "Hello, IncludeHelp";
$pattern = "/el/m";
echo preg_match($pattern, $str);
?>
- 0
- 1
- 5
- 7
Answer: B) 1
Explanation:
In the above PHP script, the pattern is found in the string and the value "m" is used to perform a multiline search (it will search the patterns for the beginning or end of a string will match the beginning or end of each line). Thus, the result will be 1.