PHP Strings


  1. Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    This matches f followed by two to four occurrences of o.


  1. POSIX implementation was deprecated in which version of PHP?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    PHP 5.3



  1. POSIX stands for











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Portable Operating System Interface for Unix


  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. View Hint View Answer Discuss in Forum

    NA

    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.



  1. Which among the following is/are not a metacharacter?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    /A, /b and /B are metacharacters. \A: Matches only at the beginning of the string. \b: Matches a word boundary. \B: Matches anything but a word boundary.