Regular Expressions - PHP quiz 2

By CareerCadets

Regular Expressions - PHP Online Quiz 2

Regular Expressions - PHP quiz 2 is a free online quiz challenge under Regular Expressions - PHP category. There are 40 free online quiz challenges available in PHP category


What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?

Say we have two compare two strings which of the following function/functions can you use? 1. strcmp() 2. strcasecmp() 3. strspn() 4. strcspn()

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

What will be the output of the following PHP code?

<?php
$line = "You like dogs. I hate dogs. We should marry."
$sen = preg_split('/./', $line);
print_r($sen);
?>

How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

What will be the output of the following PHP code?

<?php
$username = "jasoN";
if (ereg("([^a-z])",$username))
  echo "Username must be all lowercase!";
else
  echo "Username is all lowercase!";
?>

[:alpha:] can also be specified as.

Which one of the following functions finds the last occurrence of a string, returning its numerical position?

Which one of the following preg PHP functions is used to take a string, and put it in an array?

What will be the output of the following PHP code?

<?php
$name = "What is your name?"
if (preg_match("/name/"),$name)
  echo "My name is Will Pitt ";
else
  echo "My name is not Will Pitt ";
if (preg_match("/are/"))
  echo "I am great"
else
  echo "I am not great";    
?>

Invite your friends to Regular Expressions - PHP quiz 2 Quiz

gmail WhatsApp Facebook Twitter Outlook Linkedin