PHP Strings
- Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
This matches f followed by two to four occurrences of o.
- POSIX implementation was deprecated in which version of PHP?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
PHP 5.3
- POSIX stands for
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Portable Operating System Interface for Unix
- 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!";
?>
-
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.
- Which among the following is/are not a metacharacter?
-
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.