Test for PHP String Functions Knowledge

Akela
3604
Test for PHP String Functions Knowledge
Working with strings is a very important part of PHP. There are functions to carry out all possible kinds of actions, but there are a few that every developer should know. Ready to check your knowledge? Let's go!

What does $search mean in the strpos($str, $search) function?

A symbol, for which the function searches in the $str string and returns 0, if the symbol is not found

A substring or a symbol, to which position the function returns in the $str string

A string, in which the function searches for the $str symbol

What's the difference between strpos() and mb_strpos()?

The mb_strpos() function doesn't exist

strpos()searches for occurrence from the beginning of a string, and mb_strpos() – to the end

It’s better to use mb_strpos() for Cyrillic characters

For what is the strrpos() function?

Search for the first occurrence of a substring or a symbol in a string

Memory size, which a string occupies

Search for the last occurrence of a substring or a symbol in a string

What does the trim($str) function delete?

Starting and ending spaces

Starting and ending spaces, symbols '\n', '\r', '\t'

All spaces and symbols '\n', '\r', '\t'

What function converts a string into lowercase?

strtolower

strdown

lowstr

What does the strlen() function return?

Memory size, which a string occupies

The number of symbols in a string

The same string but with no numbers

What function can substract symbols from 3 to 10 inclusively in the $srt string?

substr($str, 2, 8);

substr($str, 3, 8);

substr($str, 3, 7);

What does the str_replace($old, $new, $input) function do?

Replaces the $old string with the $new string writing it into the $input variable

Replaces $old symbols with $new symbols in the $input string

Deletes $old symbols and adds $new symbols in the end of the $input string

What function is equivalent to the $rtrim() function?

ltrim();

right_trim();

chop();

For what the is htmlspecialchars function?

To transform symbols, which have a special value in HTML

To process symbols not used in HTML

To delete symbols, which have a special value in HTML

What will the strstr("http://www.mysite.com", "w") function return?

true

www

www.mysite.com

What's the difference between stristr() and strstr()?

No difference

strstr() is not case sensitive

stristr() is not case sensitive

What will be written in the $var variable as a result of this code execution: $var = strspn("Number 30 is less than number 450", "1234567890");?

3

3045

30

For what is wordwrap function used?

String cutting to a given number of characters

String wrapping to a given number of characters

Deletion of the specified number of symbols from the end of a string

What action does the strip_tags() function carry out?

Deletes HTML tags from a string

Deletes symbols < and > from a string

Leaves only HTML tags in a string

You know the subject at initial level

Probably, you haven't yet managed to learn the most important functions to be able to work with strings. Make sure to devote more time to the subject! For better understanding, we recommend that you to solve problems on the subject and, of course, to learn the theory. Good luck! Share the quiz with friends and check their knowledge :)

You know the subject at middle level

You can properly work with strings, but there are problems, which can bring you to your wit's end. Don't be upset! Remember your mistakes, learn theory and solve a few problems and you'll definitely succeed! Share the quiz with friends and check their knowledge :)

You know the subject perfectly

You're a master of work with strings in PHP. We can only congratulate you :) You can shift to learning new subjects! Share the quiz with friends and check their knowledge :)

What does $search mean in the strpos($str, $search) function?
1 / 15
What's the difference between strpos() and mb_strpos()?
2 / 15
For what is the strrpos() function?
3 / 15
What does the trim($str) function delete?
4 / 15
What function converts a string into lowercase?
5 / 15
What does the strlen() function return?
6 / 15
What function can substract symbols from 3 to 10 inclusively in the $srt string?
7 / 15
What does the str_replace($old, $new, $input) function do?
8 / 15
What function is equivalent to the $rtrim() function?
9 / 15
For what the is htmlspecialchars function?
10 / 15
What will the strstr("http://www.mysite.com", "w") function return?
11 / 15
What's the difference between stristr() and strstr()?
12 / 15
What will be written in the $var variable as a result of this code execution: $var = strspn("Number 30 is less than number 450", "1234567890");?
13 / 15
For what is wordwrap function used?
14 / 15
What action does the strip_tags() function carry out?
15 / 15

Calculating results...

Useful and short ads help us create new content every day.