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); 
?>
  1. 0
  2. 1
  3. 5
  4. 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.


Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.