A

Admin • 832.27K Points
Coach

Q. What is the result of the following PHP code?

Code:
<?php
$username = "Alex";
if (preg_match("([^a-z])",$username))
echo "Username must be all lowercase!";
else
echo "Username is all lowercase!";
?>
  • (A) Error
  • (B) Username must be all lowercase!
  • (C) Username is all lowercase!
  • (D) No Output
  • Correct Answer - Option(B)
  • Views: 22
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin

The built-in function preg_match() returns whether a match was found in a string.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.