12. 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);
?>
<?php
$foods = array("pasta", "steak", "fish", "potatoes");
$food = preg_grep("/^s/", $foods);
print_r($food);
?>
13. Say we have two compare two strings which of the following function/functions can you use?
1. strcmp()
2. strcasecmp()
3. strspn()
4. strcspn()
1. strcmp()
2. strcasecmp()
3. strspn()
4. strcspn()
14. Which one of the following functions will convert a string to all uppercase?
15. What will be the output of the following PHP code?
<?php
$title = "O'malley wins the heavyweight championship!";
echo ucwords($title);
?>
<?php
$title = "O'malley wins the heavyweight championship!";
echo ucwords($title);
?>
16. What will be the output of the following PHP code?
<?php
echo str_pad("Salad", 5)." is good.";
?>
<?php
echo str_pad("Salad", 5)." is good.";
?>
17. Which one of the following functions can be used to concatenate array elements to form a single delimited string?
18. Which one of the following functions finds the last occurrence of a string, returning its numerical position?
19. 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.";
?>
<?php
$author = "nachiketh@example.com";
$author = str_replace("a","@",$author);
echo "Contact the author of this article at $author.";
?>
20. What will be the output of the following PHP code?
<?php
$url = "contact@examveda.com";
echo ltrim(strstr($url, "@"),"@");
?>
<?php
$url = "contact@examveda.com";
echo ltrim(strstr($url, "@"),"@");
?>