CSE :: PHP - CS
- 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
$foods = array("pasta", "steak", "fish", "potatoes");
$food = preg_grep("/^s/", $foods);
print_r($food);
?>
-
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 one of the following functions will convert a string to all uppercase?
-
What will be the output of the following PHP code?
<?php
echo str_pad("Salad", 5)." is good.";
?>
- Which one of the following functions can be used to concatenate array elements to form a single delimited string?
- Which one of the following functions finds the last occurrence of a string, returning its numerical position?
-
What will be the output of the following PHP code?
<?php
$author = "nachiketh@example.com";
$author = str_replace("a","@",$author);
echo "Contact the author of this article at $author.";
?>
-
What will be the output of the following PHP code?
<?php
$url = "contact@examveda.com";
echo ltrim(strstr($url, "@"),"@");
?>
-
What will be the output of the following PHP code?
<?php
$number = array(0,1,two,three,four,5);
$num = preg_grep("/[0-5]/", $number);
print_r($num);
?>