PHP Functions
- What will be the output of the following PHP code?
<?php
echo stripos("I know the php, I love to know the php too!","know");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The stripos() function finds the position of the first occurrence of a string inside another string.
- What will be the output of the following PHP code?
<?php
$title = "interview mania founded by manjesh ojha";
echo ucwords($title);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The ucwords() function capitalizes the first letter of each word in a string. Its prototype follows: string ucwords(string str).
- What will be the output of the following PHP code?
<?php
echo str_pad("This", 10)." theory is good.";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The str_pad() function pads a string with a specified number of characters.
- What will be the output of the following PHP code?
<?php
$string = "Interview Mania";
echo wordwrap($string, 9, "\n");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The wordwrap() function wraps a string into new lines when it reaches a specific length.
- What will be the output of the following PHP code?
<?php
echo ucwords("this is an important.");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The ucwords() function converts the first character of each word in a string to uppercase.