What will be the output of the following PHP code (27)?

128. What will be the output of the following PHP code?

<?php
$str = "Hello, IncludeHelp";
$pattern = "/includehelp/i";

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 i enables the case-insensitivity. Thus, the result will be 1.

Comments and Discussions!

Load comments ↻






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