Home » PHP » PHP Strings » Question
  1. What will be the output of the following PHP code?
    $name = "mAnjeSh";
    if (ereg("([^a-z])",$name))
    echo "Name must be all lowercase!";
    else
    echo "Name is all lowercase!";
    ?>
    1. Name is all lowercase!
    2. No Output is returned
    3. Name must be all lowercase!
    4. Error
    5. None of these
Correct Option: C

Because the provided name is not all lowercase, ereg() will not return FALSE (instead returning the length of the matched string, which PHP will treat as TRUE), causing the message to output.



Your comments will be displayed only after manual approval.